Neuroimaging studies have demonstrated the association of the cognitive control network (CCN) with the maintenance of chronic pain. However, whether and how dorsolateral prefrontal cortex (DLPFC), a key region within the CCN, is altered in menstrual pain is unclear. In this study, we aimed to investigate alterations in the DLPFC functional connectivity network in patients with primary dysmenorrhea (PDM). The study comprised 41 PDM patients and 39 matched healthy controls (HCs), all of whom underwent a resting-state functional MRI scan during the menstrual stage. All participants were instructed to complete the clinical assessment before the MRI scan. We used the DLPFC as the seed in resting-state functional connectivity (rsFC) analysis to investigate the difference between PDM patients and HCs. Compared to HCs, PDM patients showed increased right DLPFC rsFC at the bilateral lingual gyrus, dorsal anterior cingulate cortex (dACC), and middle cingulate cortex, and decreased left DLPFC rsFC at the right orbital frontal cortex. In addition, increased right DLPFC-bilateral dACC connectivity mediated the association between disease duration and the self-rating anxiety scale (SAS) scores in PDM patients. We confirmed that the DLPFC-dACC rsFC was associated with higher SAS scores, which could mediate the association between disease duration and anxiety symptoms in patients with PDM. Our findings provide central pathological evidence for an abnormal rsFC of the CCN in PDM patients, which may contribute to a better understanding of the neuropathophysiological mechanisms underlying PDM.