Abstract Background Altitude affects biodiversity and physic-chemical properties of soil, providing natural sites for studying species distribution and the response of biota to environmental changes. We sampled soil at three altitudes in an arid valley, determined the physic-chemical characteristics and microbial community composition in the soils, identified differentially abundant taxa and the relationships between community composition and environmental factors. Results The low, medium and high altitudes were roughly separated based on the physic-chemical characteristics and clearly separated based on the microbial community composition. The differences in community composition were associated with differences in soil pH, temperature, and SOC, moisture, TN, TP, AN, AP and SMBC contents. The contents of organic and microbial biomass C, total and available N and available P, and the richness and diversity of the microbial communities were lowest in the medium altitude. The relative abundances of phyla Proteobacteria, Gemmatimonadetes, Actinobacteria and Acidobacteria were high at all altitudes. The differentially abundant amplified sequence variants (ASVs) were mostly assigned to Proteobacteria and Acidobacteria. The highest number of ASVs characterizing altitude were detected in the high altitude. However, the predicted functions of the communities were overlapping, suggesting that the contribution of the communities to soil processes changed relatively little along the altitude gradient. Conclusions The low, medium and high altitudes were roughly separated based on the physicochemical characteristics and clearly separated based on the microbial community composition. The differences in community composition were associated with differences in soil pH, temperature, and SOC, moisture, TN, TP, AN, AP and SMBC contents.