Autotrophic microorganisms can fix carbon dioxide (CO2) into organic carbon (C), potentially offering a natural mechanism to mitigate global climate change. Forest soils, recognized as vast and critical C repositories with significant microbial CO2 fixation rates, remain understudied, particularly regarding the spatial variations of autotrophic bacteria and their relationship to soil functions in arid regions. In this study, we systematically investigated soil multifunctionality, along with the spatial distribution of autotrophic bacterial communities identified by the RubisCO cbbL and cbbM genes, and the driving factors across a longitudinal gradient in the Loess Plateau forest soils. The investigation spanned an ∼850 km west-east transect with precipitation below 600 mm. The alpha diversity of cbbL-containing bacteria, as measured by the Chao1 index, was correlated with climatic variables such as precipitation and elevation instead of local soil characteristics. In contrast, the alpha diversity of cbbM-containing bacteria was associated with soil properties. The community composition of autotrophic bacteria, based on cbbL and cbbM genes, showed greater similarity in soils from the eastern Loess Plateau and was distinct from those in the western region. The cbbL- and cbbM-containing generalist taxa were subject to differential selection and promotion between the eastern and western regions. Temperature, soil pH and spatial variables were key drivers influencing the community composition of cbbL- and cbbM-containing bacteria. The diversity and communities of soil autotrophic bacteria significantly affected soil multifunctionality. The study demonstrates that soil autotrophic bacteria in forest soils are intricately connected to climatic conditions, soil pH and spatial factors, significantly impacting soil multifunctionality. These insights provide evidence that can be instrumental in predicting and potentially enhancing the functional capacity of forest ecosystems in the Loess Plateau.