In contrast to private cars, rail transit systems are a more effective way to deal with the emerging challenges in cities with high population densities, such as congestion, air pollution, and traffic emissions. Rail transit systems, however, are commonly costly, due to substantial investments in construction and maintenance. It is thus necessary to design the candidate rail transit systems carefully to ensure public transport accessibility and sustainability, with consideration of the space-time correlation of population densities. In this paper, the space-time correlations of population densities are incorporated into the design of a candidate rail transit line over years. A closed-formed mathematical programming model is proposed, with an optimisation objective of social welfare budget maximisation. The social welfare budget is defined as the summation of the expected social welfare and social welfare margins. The model decision variables include rail line length, rail station number, and project start time of the candidate rail transit line. The analytical solutions for the proposed rail design model are given explicitly for different scenarios with various constraints.