The influence of ribs on the train aerodynamic performance was computed using detached eddy simulation (DES), and the transient iteration was solved by the dual-time step lower-upper symmetric Gauss-Seidel (LU-SGS) method. The results show that the ribs installed on the roof have a great effect on the train aerodynamic performance. Compared with trains without ribs, the lift force coefficient of the train with convex ribs changes from negative to positive, while the side force coefficient increases by 110% and 88%, respectively. Due to the combined effect of the lift force and side force, the overturning moment of the train with convex ribs and cutting ribs increases by 140% and 106%, respectively. There is larger negative pressure on the roof of the train without ribs than that with ribs. The ribs on the train would disturb the flow structure and contribute to the air separation, so the separation starts from the roof, while there is no air separation on the roof of the train without ribs. The ribs can also slow down the flow speed above the roof and make the air easily sucked back to the train surface. The vortices at the leeward side of the train without ribs are small and messy compared with those of the train with convex or cutting ribs.