To meet the demands of power supply for applications along the railway in treacherous terrain, this article proposes a portable photovoltaic power generation system (PVPGS) based on a foldable mechanism for applications along the railway. First, the designed system mainly consists of a foldable solar energy collector (FSEC) and an energy conduit. Dust deposited on the photovoltaic panels is reduced while the FSEC is being folded or unfolded. Moreover, the characteristics of dust particles, effects of natural dust on photovoltaic glass transmittance, and power of portable PVPGS are investigated. In addition, the mechanism on improving the power generation efficiency of PVPGS is analyzed. The results demonstrate that the designed foldable mechanism can contain the dust deposition on photovoltaic power loss within 4%. Finally, Chengdu city and Sichuan–Tibet Railway are selected for an application prospect, and the results show that the average annual power generation of one portable PVPGS can reach up to 16.7 kWh, which is enough to power sensors and other applications along the railway. Simulations, theoretical analyses, and experiments confirm the feasibility of using the proposed portable PVPGS to power applications along the railway.