The formation of ballast pockets results from excessive plastic deformation of clay subgrade, a common subgrade failure resulting from the repeated loading of the subgrade by passing trains. Ballast pockets reduce the stability of clay slopes under railway embankments, further affecting the safe traversal of freight trains on the track. Therefore, quantifying the impact of ballast pockets on slope stability is important for railway operation safety. This thesis uses two-dimensional models using the finite element shear strength reduction method to conduct a coupled deformation and pore fluid flow analysis for slope stability evaluation under undrained conditions. The control variable method is used to perform a series of parameter studies, including geometric characteristics of the slope, railway embankment and ballast pockets, and freight train speeds. For slopes with different parameters, maximum safe train speed information is presented with a minimum factor of safety of 1.3. The research results show that freight trains can traverse on tracks built on a lower slope of 3H:1V inclination and a 3 m railway embankment at a relatively higher maximum safe speed. Finally, this research identifies the maximum safe speed a train can use, through given the geometric parameters of the slope, railway embankment, and ballast pockets.