AimTo develop a visual prediction model for gestational diabetes (GD) in pregnant women and to establish an effective and practical tool for clinical application.MethodsTo establish a prediction model, the modelling set included 1756 women enrolled in the Zunyi birth cohort, the internal validation set included 1234 enrolled women, and pregnant women in the Wuhan cohort were included in the external validation set. We established a demographic–lifestyle factor model (DLFM) and a demographic–lifestyle–environmental pollution factor model (DLEFM) based on whether the women were exposed to environmental pollutants. The least absolute shrinkage and selection lasso–logistic regression analyses were used to identify the independent predictors of GD and construct a nomogram for predicting its occurrence.ResultsThe DLEFM regression analysis showed that a family history of diabetes (odd ratio [OR] 2.28; 95% confidence interval [CI] 1.05‐4.71), a history of GD in pregnant women (OR 4.22; 95% CI 1.89‐9.41), being overweight or obese before pregnancy (OR 1.71; 95% CI 1.27‐2.29), a history of hypertension (OR 2.61; 95% CI 1.41‐4.72), sedentary time (h/day) (OR 1.16; 95% CI 1.08‐1.24), monobenzyl phthalate (OR 1.95; 95% CI 1.45‐2.67) and Q4 mono‐ethyl phthalate concentration (OR 1.85; 95% CI 1.26‐2.73) were independent predictors. The area under the receiver operating curves for the internal validation of the DLEFM and the DLFM constructed using these seven factors was 0.827 and 0.783, respectively. The calibration curve of the DLEFM was close to the diagonal line. The DLEFM was thus the more optimal model, and the one which we chose.ConclusionsA nomogram based on preconception factors was constructed to predict the occurrence of GD in the second and third trimesters. It provided an effective tool for the early prediction and timely management of GD.