In this register‐based cohort study, we estimated the incidence of human papillomavirus (HPV)‐related anogenital precancer and cancer in women with diabetes compared with women without diabetes. We followed all women living in Denmark born 1916 to 2001 (n = 2 508 321) for individual‐level information on diabetes (Type 1 or 2 [T1D or T2D]), diagnoses of cervical, vaginal, vulvar and anal intraepithelial neoplasia Grade 2 or 3 (IN2/3) and cancer and other covariates from nationwide registries. We used Poisson regression to model the incidence rates of anogenital IN2/3 and cancer as a function of diabetes status, age, HPV vaccination, education, calendar year, and cervical cancer screening status. Incidence rate ratios (IRRs) were estimated for diabetes overall, and separately for T1D and T2D, compared with women without diabetes. Women with diabetes had higher rates of vulvar IN2/3 (IRR = 1.63; 95% confidence interval [CI]: 1.41‐1.88), vulvar cancer (IRR = 1.61; 95% CI: 1.36‐1.91) and vaginal cancer (IRR = 1.79; 95% CI: 1.27‐1.91) than women without diabetes. Similar patterns were observed for anal IN2/3, anal cancer and cervical cancer, although not statistically significant. In contrast, women with diabetes had lower rates of cervical IN2/3 (IRR = 0.74; 95% CI: 0.69‐0.79) than women without diabetes. Patterns were generally similar in women with T1D and T2D, although cancer rates were higher in women with T2D. In conclusion, the incidence of most anogenital precancers and cancers were increased in women with diabetes. However, women with diabetes had lower incidence of cervical precancer. Our findings could be explained by biological mechanisms and/or behavioral factors, such as smoking and less frequent cervical screening participation.