Diabetes is a metabolic disorder caused by various genetic, physiological and behavioral factors. It occurs due to an imbalance in the body’s insulin processing, which results in elevated blood sugar levels. Its early diagnosis can alleviate the risk of other deadly diseases. The onset and accurate detection of diabetes can decrease the progression of different complications and dysfunction of tissues. The principal objective of this article is to utilize machine learning approaches to predict the existence of diabetes in female patients at a primary stage. Multiple machine learning, including ensemble classifiers with the Pima Indian dataset and a private dataset obtained from a local Bangladeshi hospital, are used in this work. We employed feature scaling, synthetic oversampling technique (SMOTE), and hyperparameter optimization with GridSearchCV to get the best performance from different machine learning algorithms. The support vector machine (SVM) with the SMOTE framework and default hyperparameters achieved the accuracy and F1 score of 87% and 91%, respectively. The accuracy and F1 score of the SVM model improved to 95% and 91%, respectively, with hyperparameter optimization. Finally, explainable artificial intelligence with the local interpretable model-agnostic explanations (LIME) is employed to illustrate the predictability of the SVM technique.