Abstract Background/Introduction Accurately predicting and managing the risk of sudden cardiac death (SCD) in the general population is a formidable challenge. Purpose This study aimed to develop and validate a machine learning (ML)-based prediction model for SCD using data from the Community Cardiovascular Cohort (CCCC) in Taiwan. Methods A community-based cohort study was used for model construction . Four ML algorithms, including extreme gradient boosting (XGBoost), random forests (RF), logistic regression, and deep neural network (DNN), underwent meticulous evaluation. Performance assessment encompassed receiver operating characteristic (ROC) curves, area under the curves (AUC), and accuracy metrics. Significant risk factors were identified through feature importance analysis. Results We employed a random partitioning strategy, allocating 1744 participants (55%) to the training dataset, 952 participants (30%) to the test dataset, and 476 participants (15%) to the validation dataset. In the data training stage, the XGBoost algorithm demonstrated outstanding prediction performance for SCD (AUC: 1.000); In the validation stage, the XGBoost algorithm demonstrated good prediction performance for SCD prediction (AUC: 0.791, 95%CI: 0.617-0.964; Accuracy: 0.971). Using XGBoost-generated predicted probabilities (P(XGB)), we identified individuals with P(XGB) ≥ 0.5 (Group 1) who displayed significantly higher SCD risk (HR 32.0; 95% CI: 9.29-109.9) compared to those with P(XGB) < 0.5 (Group 0). Conclusions Our study demonstrates the effectiveness of ML algorithms, particularly XGBoost, in predicting event of SCD in the general population. The identification of these pivotal risk factors holds profound implications, empowering the identification of high-risk individuals and facilitating the implementation of precisely tailored preventive strategies.Figure 1:KM sruvival curveFigure 2:Feature importance analysis