As an important part of the transportation system, railways consume huge amounts of electricity. To meet energy-saving demands, reduce carbon emissions, and promote sustainable and low-carbon development of railway systems, the utilization of distributed photovoltaic (PV) generation to offset some of the energy consumption is of paramount importance. This paper investigates the causes by which PV generation units, when integrated into the railway through line power supply system, impact power quality. A reliability evaluation method based on the analytic hierarchy process (AHP) is established, alongside the design of comprehensive evaluation indicators. By constructing a model of the railway through line power supply system, this research delves into the effects of distributed PV grid-connected capacity, grid-connected location, and integration methods on the reliability of power supply to the railway through line. A deeper exploration is conducted into the impact of PV integration on the power quality at various nodes of the railway through line, providing theoretical references for large-scale integration of distributed PV units into the railway power supply system in the future.