We aimed to determine the best-performing machine learning (ML)-based algorithm for predicting gestational diabetes mellitus (GDM) with sociodemographic and obstetrics features in the pre-conceptional period. We collected the data of pregnant women who were admitted to the obstetric clinic in the first trimester. The maternal age, body mass index, gravida, parity, previous birth weight, smoking status, the first-visit venous plasma glucose level, the family history of diabetes mellitus, and the results of an oral glucose tolerance test of the patients were evaluated. The women were categorized into groups based on having and not having a GDM diagnosis and also as being nulliparous or primiparous. 7 common ML algorithms were employed to construct the predictive model. 97 mothers were included in the study. 19 and 26 nulliparous were with and without GDM, respectively. 29 and 23 primiparous were with and without GDM, respectively. It was found that the greatest feature importance variables were the venous plasma glucose level, maternal BMI, and the family history of diabetes mellitus. The eXtreme Gradient Boosting (XGB) Classifier had the best predictive value for the two models with the accuracy of 66.7% and 72.7%, respectively. The XGB classifier model constructed with maternal sociodemographic findings and the obstetric history could be used as an early prediction model for GDM especially in low-income countries.