Exploring the effects of artificial Haloxylon ammodendron forest planting on the structure and function of a desert soil bacterial community provides data reference for soil micro-ecological restoration and land quality improvement in desert oasis transition zones. Illumina high-throughput sequencing technology and PICRUSt2 functional prediction analysis were used to identify and analyze the structure and function of soil bacterial communities, and the Mantel correlation test and RDA analysis were used to explain the physicochemical factors affecting the structure and function of soil bacterial communities. The results showed that:① the soil bacterial OTU number, Chao1 index, and Shannon index were significantly higher in the H. ammodendron forest than in the mobile dune soil, and the PCoA analysis and Adonis test showed significant differences in the soil bacterial community structure between H. ammodendron and mobile dune soil (P=0.001). ② A total of 34 phyla, 89 classes, 174 orders, 262 families, and 432 genera of bacteria were detected in all samples, and the phyla Proteobacteria, Actinobacteria, Cyanobacteria, and Chloroflexi accounted for 76.05% of the relative abundance of soil bacteria, which belonged to the dominant soil bacteria, among which the relative abundance of Actinobacteria in H. ammodendron forest soil was extremely significantly higher than that in mobile dune soil (P < 0.01). ③PICRUSt2 function prediction revealed that the soil bacterial community of H. ammodendron forest included six categories of primary functions and 28 categories of secondary functions, among which the metabolism of carbohydrates, metabolism of amino acids, and metabolism of cofactors and vitamins were all greater than 10% in relative abundance and were the main metabolic functions of H. ammodendron forest soil bacteria. ④ The planting of H. ammodendron forest significantly improved the nutrient content of soil organic matter and other nutrients. Soil pH, organic matter, total nitrogen, and fast-acting phosphorus were the main physicochemical factors affecting the bacterial community, with soil organic matter significantly affecting the soil bacterial community structure (P < 0.05) and metabolic function (P < 0.05). In conclusion, the artificial H. ammodendron forest helped to increase desert soil microbial diversity, increase the relative abundance of soil bacterial metabolic function genes, and improve the desert soil microenvironment.