Abstract Background Aerobic vaginitis (AV) caused by abnormal aerobic bacterial infections, is characterized by inflammation, and dysbiosis of vaginal microbiota. The traditional herbal medicine, Mahonia Fortunei, has shown potential anti-inflammatory and antimicrobial properties, which could be beneficial for treating AV. Methods In this study, both low-dose and high-dose Mahonia Fortunei treatments were administered to AV model rats induced by Staphylococcus aureus infection. Vaginal pH levels, bacterial infection, and neutrophil infiltration were measured. Network pharmacology analysis was conducted to identify bioactive ingredients, and 16S rDNA analysis was used to study the vaginal microbiota composition and explain the mechanisms of inflammatory action. Results The results indicated that Mahonia Fortunei significantly reduced vaginal pH, alleviated bacterial infections, and decreased neutrophil infiltration in AV rats. Bioactive compounds such as berberine, coptisine, and palmatine were selected for network pharmacological analysis. KEGG analysis showed that Mahonia Fortunei downregulated inflammatory pathways such as JAK-STAT and NF-κB, thereby reducing pro-inflammatory cytokines IL-1. Additionally, Mahonia Fortunei restored vaginal microbiota diversity, particularly increasing Gammaproteobacteria, a crucial biomarker for vaginal dysbiosis, and downregulating oxidative phosphorylation and stress-related pathways, reducing oxidative stress and inflammation. Conclusion Mahonia Fortunei exhibited significant therapeutic potential in treating AV by regulating vaginal microbiota, reducing inflammation, and restoring vaginal health.