The rising global burden of diabetes mellitus has increased the need for accurate, technology-based early detection systems. This study develops a diabetes classification model using Extreme Gradient Boosting (XGBoost) optimized through a two-stage Particle Swarm Optimization (PSO) scheme: Binary PSO (BPSO) for feature selection and Global Best PSO (GBPSO) for hyperparameter tuning. Data were obtained from the Kaggle Diabetes Prediction Dataset (100,000 records; eight clinical attributes: gender, age, hypertension, heart disease, smoking history, BMI, HbA1c level, and blood glucose level). The extreme class imbalance (91.5% normal vs 8.5% diabetes) was addressed using the SMOTETomek hybrid technique. BPSO retained all eight features as the optimal combination (best cost 0.0329; F1-weighted 96.71%), while GBPSO produced the best hyperparameter configuration (n_estimators=416, learning_rate=0.237, max_depth=3, min_child_weight=3; best cost 0.0308, converging at the 11th iteration). The final model achieved 97.15% test-set accuracy, a ROC-AUC of 0.9779, and a diabetes-class precision of 0.93. The model was deployed as a Streamlit-based web system classifying patients into three risk categories: Not Indicated, Early Risk Indicated, and Diabetes Indicated. Preliminary validation on five real patient records from an anonymized partner hospital in Jayapura City showed classification results fully consistent with patients' clinical status (5 of 5 correct), indicating potential clinical applicability, although larger-scale testing is still required. These findings demonstrate that integrating XGBoost with a two-stage PSO optimization scheme produces an accurate and clinically applicable diabetes classification model.