The operation of intercity rail transit has greatly relieved the pressure of urban traffic. In order to improve the operation quality and passenger carrying capacity, the scheduling strategy of urban rail needs to be timely adjusted according to the passenger flow and other disturbing factors, especially the traffic control problems brought by the outbreak of the epidemic. In this paper, according to the epidemic situation and the characteristics of peak passenger flow in the morning and evening, an optimization model is designed to minimize the travel cost of passengers and the daily cost of the urban rail operation company. The optimal solution of the model is found through the reinforcement learning algorithm. Finally, based on the parameters of Shijiazhuang Metro, the optimal train scheduling scheme is obtained through simulation, which verifies the effectiveness of the research method in this paper.