Emerging evidence has demonstrated that melatonin (MT) plays a crucial role in regulating mammalian reproductive functions. It has been reported that MT has a protective effect on polycystic ovary syndrome (PCOS). However, the protective mechanisms of MT remain poorly understood. This study aims to explore the effect of MT on ovarian function in PCOS and to elucidate the relevant molecular mechanisms in vivo and in vitro. We first analysed MT expression levels in the follicular fluid of PCOS patients. A significant reduction in MT expression levels was noted in PCOS patients. Intriguingly, reduced MT levels correlated with serum testosterone and inflammatory cytokine levels in follicular fluid. Moreover, we confirmed the protective function of MT through regulating autophagy in a DHEA-induced PCOS rat model. Autophagy was activated in the ovarian tissue of the PCOS rat model, whereas additional MT inhibited autophagy by increasing PI3K−-Akt pathway expression. In addition, serum-free testosterone, inflammatory and apoptosis indexes were reduced after MT supplementation. Furthermore, we also found that MT suppressed autophagy and apoptosis by activating the PI3K-Akt pathway in the DHEA-exposed human granulosa cell line KGN. Our study showed that MT ameliorated ovarian dysfunction by regulating autophagy in DHEA-induced PCOS via the PI3K-Akt pathway, revealing a potential therapeutic drug target for PCOS.