Androgens play a protective role in alleviating chronic pain in women, including pelvic pain; however, their specific role and underlying mechanism in the treatment of primary dysmenorrhea (PD) remain unclear. In this study, clinical data revealed that women with PD exhibited reduced serum testosterone levels, which were inversely correlated with the severity of dysmenorrhea compared to healthy controls. Using a mouse model of PD, we observed significant upregulation of Hsp90ab1 and the PD markers COX-2 in the uterus. Treatment with dehydroepiandrosterone (DHEA), an androgen precursor, suppressed the uterine expression of Hsp90ab1 and COX-2, alleviating pain symptoms. Notably, pharmacological inhibition of Hsp90ab1 with geldanamycin reduced COX-2 expression by inactivating the p-p38 and p-JNK signaling pathways, and effectively mitigated PD. Further analysis identified specificity protein 1 (SP1) as a key driver of Hsp90ab1 transcription through its binding to the promoter region. Inhibition of SP1 using plicamycin reduced Hsp90ab1 expression, alleviated pain, and decreased uterine edema in the mouse model. Conversely, lentiviral overexpression of Hsp90ab1 reversed the therapeutic effects of DHEA, including nociception relief, reduction of uterine edema, and suppression of COX-2 expression. These findings suggest that androgen deficiency triggers SP1-mediated upregulation of Hsp90ab1 and COX-2, forming a critical regulatory loop that exacerbates menstrual cramps. Targeting this pathway represents a promising therapeutic strategy for managing PD.