This study aimed to compare the differences in the bacterial community structure of Lycium barbarum rhizosphere and elucidate the contribution of rhizosphere bacteria to the active ingredients of L. barbarum fruit. This study investigated the soil and meteorological characteristics of L. barbarum rhizosphere during three growth stages across three production regions of China. High-throughput sequencing showed significant differences in the bacterial community diversity of L. barbarum rhizosphere across the three production regions, and norank_o_Gaiellales, norank_f_Anaerolineaceae and norank_f_AKYG1722 were the highest in Ningxia. In addition, regression and path analysis revealed that pH, norank_o_Gaiellales and norank_f_AKYG1722 significantly promoted the accumulation of total sugar and flavonoids in L. barbarum fruit directly or indirectly. Soil organic matter (SOM), norank_f_Anaerolineaceae and humidity significantly promoted the accumulation of betaine. The average temperature during the growth stages, norank_f_AKYG1722, and norank_o_Gaiellales promoted the accumulation of polysaccharides. The interaction between rhizosphere bacteria and environmental factors promoted the accumulation of active ingredients in L. barbarum fruits. Our results provided insights to improve the quality of L. barbarum fruit.