To examine the effect of diet quality on the risk of gestational diabetes mellitus. This review included cohort and case-control studies reporting an association between diet quality and gestational diabetes mellitus. We searched PubMed, Cochrane Library, Web of Science, Embase, PsycINFO, CINAHL Complete, Chinese Periodical Full-text Database, China National Knowledge Infrastructure, Chinese Biomedical Literature Database, and China Wanfang Database for studies published from inception to November 18, 2022. The Newcastle-Ottawa Scale was used for quality assessment, and the overall quality of evidence was assessed using the GRADEpro GDT. A total of 19 studies (15 cohort, four case-control) with 108,084 participants were included. We found that better higher diet quality before or during pregnancy reduced the risk of developing gestational diabetes mellitus, including a higher Mediterranean diet (OR: 0.51; 95% CI: 0.30-0.86), dietary approaches to stop hypertension (OR: 0.66; 95% CI: 0.44-0.97), Alternate Healthy Eating Index (OR: 0.61; 95% CI: 0.44-0.83), overall plant-based diet index (OR: 0.57; 95% CI: 0.41-0.78), and adherence to national dietary guidelines (OR: 0.39; 95% CI:0.31-0.48). However, poorer diet quality increased the risk of gestational diabetes mellitus, including a higher dietary inflammatory index (OR: 1.37; 95% CI: 1.21-1.57) and overall low-carbohydrate diets (OR: 1.41; 95% CI: 1.22-1.64). After meta-regression, subgroup, and sensitivity analyses, the results remained statistically significant. Before and during pregnancy, higher diet quality reduced the risk of developing gestational diabetes mellitus, whereas poorer diet quality increased this risk. https://www.crd.york.ac.uk/PROSPERO/, identifier: CRD42022372488.