The growth of China's railway construction industry has significantly impacted the surrounding ecological environment. Therefore, to improve the habitat quality of railway construction regions and strengthen ecological safety, it is crucial to determine the effects and development patterns of railway construction on altering land use and habitat quality in the areas along the railway line. This study focuses on the Mudanjiang-Jiamusi high-speed railway (Mujia HSR) as a case study. A dynamic analysis method is employed to investigate the transformation of various land use types, providing insights into the patterns of land use change during the construction phase. Additionally, the Integrated Valuation of Ecosystem Services and Tradeoffs (InVEST) model is applied to quantify habitat quality in the pre-construction and construction periods of Mujia HSR to analyze spatial changes. Subsequently, geodetectors are utilized to identify factors associated with habitat quality along the railway and to clarify the explanatory power of the factors on the spatial differentiation characteristics of the habitat quality by calculating intra- and inter-layer variance. The results reveal that the land use types in the region along the Mujia HSR are dominated by cropland and forest. Cropland exhibited the greatest reduction during the construction of the Mujia HSR (by 60.81 km2), with a decrease rate of 3.3 %, while impervious increased the most (by 37.26 km2), with an increase rate of 2 %. The land was generally converted from cropland into forest and impervious. The habitat quality along the Mujia HSR is generally low, with the average habitat quality increasing marginally from 0.396 to 0.406 between 2000 and 2020. Spatially, the low and relatively low types were concentrated in urban development areas, and medium- and high-quality habitats were distributed in nature reserves and forest parks, where anthropogenic disturbance is low. The maximum value of habitat degradation decreased from 0.357 to 0.352, with a spatial gradient distribution pattern. The increase in impervious and the decrease in forest are the key factors influencing habitat quality degradation. The spatial variation in habitat quality was associated with a variety of factors, with net primary productivity (NPP, q = 0.627) and normalized difference vegetation index (NDVI, q = 0.570) exhibiting higher explanatory power, while socio-economic factors had a weaker impact. Moreover, the explanatory power of the interactions between different factors was significantly greater than that of individual factors, as indicated by the interaction between ground temperature with NPP (q = 0.6502) and NPP with NDVI (q = 0.743). This study, by analyzing the spatial-temporal dynamics of land use and habitat quality during the construction of Mujia HSR, not only offers a theoretical framework for predicting ecological impacts of railway construction but also serves as a valuable reference for formulating ecological restoration plans in post-construction phases.