This was a retrospective study, mainly explored the mediating role of vaginal microenvironment and the influence of vitamin D addition on human papillomavirus (HPV) infection. Five hundred and twelve participants were chosen in this study, followed by dividing into HPV positive (212 cases) and negative groups (300 cases) based on HPV 23 typing results. The high-risk human papillomavirus (HR-HPV) positive group showed higher abnormal rates of lactobacillus, catalase, cleanliness, sialidosidase, and proline aminopeptidase than the HPV negative group. No significant differences were found in pH value, leukocyte esterase, and Acetylglucosaminidase abnormality between 2 groups. The HR-HPV positive group presented a higher percentage of patients with cleanliness III and IV. Relative to low-grade squamous intraepithelial lesion (LSIL) group, HSIL group presented a higher HPV positive infection rate. Mould infection, Gardnerella infection, and catalase were identified as independent risk elements for HR-HPV infection. Vitamin D supplementation was found to potentially reduce HR-HPV infection persistence post-Loop Electrosurgical Excision Procedure (LEEP), improve nutritional health, reduce insulin, insulin resistance (HOMA-IR) and triglyceride levels, as well as reduce high-sensitivity C-reactive protein (hs-CRP) along with malondialdehyde (MDA) levels. Our results indicate that HR-HPV infection is intimately associated with the condition of the vaginal microenvironment, and vitamin D addition potentially reduces the persistence of HR-HPV infection post-LEEP, improves nutritional and metabolic health, reduces inflammation, and be well-tolerated.