The global rise in diabetes prevalence presents a significant public health concern, emphasizing the need for accurate and efficient early detection systems. This study investigates the performance of three classification algorithms—Naïve Bayes, C4.5, and Random Forest—for predicting diabetes and explores the impact of hyperparameter tuning via Particle Swarm Optimization (PSO) on model performance. The research employs the 2023 Behavioral Risk Factor Surveillance System (BRFSS) dataset from the Centers for Disease Control and Prevention (CDC), which includes a wide range of health-related and demographic variables from adult respondents across the United States. Each algorithm was tested under two conditions: with default parameters and after optimization using PSO. Experimental results demonstrate that the Random Forest algorithm, even without optimization, yielded the highest accuracy at 95.15%, whereas Naïve Bayes showed the weakest performance. However, applying PSO significantly improved the performance of initially suboptimal models, particularly Naïve Bayes and C4.5. Specifically, Naïve Bayes accuracy increased from 80.80% to 82.24% (a 1.44% increase), and C4.5 accuracy increased from 91.22% to 91.31% (a 0.09% increase). In contrast, the effect of optimization on Random Forest was minimal, showing a slight decrease in accuracy to 94.37%, indicating the model’s robustness in its default configuration. These findings underscore the importance of algorithm selection and tailored optimization strategies in enhancing the accuracy of diabetes classification systems.