Waste pile-up along railway routes poses an important threat to the regional ecological environment. However, there is a lack of methods that assess the ecological suitability of waste pile-up (ESWP) at a macro scale, which is crucial for informed decision-making. We define the ESWP and propose a methodology to measure the level of ESWP along railway routes. Specifically, we focus on the Ya’an to Nyingchi section of the railway, selecting a 30-km buffer zone on either side as the study area. To develop ESWP maps, we employed Landsat 8, digital elevation model (DEM), soil database, land use, and meteorological data. We tested 3 machine learning methods—random forest (RF), deep neural network (DNN), and extreme gradient boosting (XGBoost)—using 7 key indicators as input parameters. The performance of these models was evaluated using overall accuracy and the Kappa index. Additionally, we analyzed the relative importance of each indicator on the results. The study reached the following results: Firstly, the combination of selected indicators with machine learning methods effectively assesses the ESWP along railways. Secondly, among the tested methods, DNN demonstrated superior performance, achieving an accuracy of 86.49%, outperforming RF (80.31%) and XGBoost (79.54%). Thirdly, the indicators with the greatest impact on the assessment were biological richness (weight is 0.23), vegetation coverage (weight is 0.20), and soil nutrients (weight is 0.16). These findings provide a novel approach to assessing the ecological suitability and identifying low-risk sites for waste pile-up along railway routes.