This paper proposes the Spatio-Temporal Crowdedness Inference Model (STCIM), a framework to infer the passenger distribution inside the whole urban rail transit (URT) system in real-time. Our model is practical since the model is designed in a probabilistic manner and only based on the entry and exit timestamps information collected by the automatic fare collection (AFC) system. Firstly, the entire URT system is decomposed into several components of stations and segments. By decomposing a passenger’s travel actions into entering, traveling, transferring, and exiting, we build a statistical model to estimate the passengers’ lingering time within each component and the passengers’ destination based on historical AFC data. Then, the passengers’ spatial distribution is predicted in real-time based on each passenger’s elapsed travel time and their entry station. The effectiveness of the scheme is validated with a real dataset from a real URT system.