Diabetes mellitus is a health problem of global concern, considering that most cases are only identified when complications arise. Therefore, early detection is essential in controlling the health and financial consequences of the disease. The purpose of this study is to compare two machine learning models using gradient boosting techniques, namely Extreme Gradient Boosting (XGBoost) and Light Gradient Boosting Machine (LightGBM). This study use a technique called RandomizedSearchCV to optimize the performance of the proposed machine learning models. In evaluating the machine learning models, the study used a variety of metrics such as accuracy, precision, recall, F1 score, and ROC-AUC. The LightGBM is a more efficient machine learning model than XGBoost based on the result. The LightGBM model had a classification accuracy of 77.3%, a precision of 71.1%, and a recall of 59.3%, which is the same value obtained by the XGBoost model. However, the LightGBM model had a higher F1 score of 64.6% and a ROC-AUC of 83.0% which indicates that the model is more balanced and can accurately classify and distinguish between the two classes. The best-performing machine learning model was integrated with a web-based system using a framework called Streamlit to create a system that is responsive, interactive, and user-friendly. The system is useful for early detection of diabetes mellitus and can be used by non-experts to determine whether a patient is at risk of developing the disease using real-time prediction and user-friendly data input. The results of the study showed that gradient boosting machine learning models can be used to diagnose and detect early cases of diabetes mellitus.