Diabetes mellitus is a chronic disease whose prevalence continues to increase worldwide, with a projected number of sufferers reaching 643 million by 2030. Early detection of diabetes is crucial to prevent serious complications such as cardiovascular disease, kidney failure, and nerve damage. This study aims to compare the performance of four machine learning algorithms (Random Forest, Support Vector Machine, Logistic Regression, and K-Nearest Neighbors) in detecting diabetes based on clinical parameters, and to identify the most significant predictor variables. The study uses the Pima Indians Diabetes dataset consisting of 768 samples with 8 predictor variables (number of pregnancies, glucose, blood pressure, skin thickness, insulin, BMI, diabetes pedigree function, and age). Data is divided into a training set (70%) and a testing set (30%) using stratified sampling. Data preprocessing includes handling missing values, feature scaling using StandardScaler, and handling imbalanced data using the SMOTE technique. Performance evaluation uses accuracy, precision, recall, F1-score, and Area Under Curve (AUC-ROC) metrics. Results show that the Random Forest model achieves the best performance with an accuracy of 81.8%, precision of 79.2%, recall of 78.5%, F1-score of 78.8%, and AUC of 0.88. Support Vector Machine achieves an accuracy of 78.0%, Logistic Regression 76.0%, and K-Nearest Neighbors 74.5%. Feature importance analysis identifies glucose (28.5%), BMI (19.8%), and age (16.5%) as the most significant predictors in diabetes detection. The Random Forest model produces 17 false negatives and 12 false positives from 231 testing samples. The study concludes that Random Forest is the most effective algorithm for early diabetes detection with good accuracy and superior interpretability through feature importance.