Abstract Background Surgical site infections (SSIs) pose a significant threat in cardiac surgery (CS), profoundly impacting patient prognosis. SSI incidence varies widely, reported between 3.5% and 26.8%. The study used a decade-long dataset from SSI surveillance in a specialized hospital in Italy, applying machine learning (ML) techniques to predict the SSI incidence among CS patients. Methods Data collected from 2013-2023 through the surveillance system of SSI in patients undergoing CS were used to train a predictive ML algorithm (XGBoost). Data included information on demographics, risk factors, surgery variables (incision site, prophylaxis, etc.), and the infection outcome derived from follow-up interviews at 30 days post-surgery, or 90 days for patients with prosthetic materials, according to the ECDC case definition of SSI. We used the R libraries “caret”, “smotefamily” and “xgboost” to train the algorithm. A train-test split of 70-30 was applied. Both downsampling of the majority class (no SSI) and oversampling of SSI cases with SMOTE were used in the training set to address class imbalance. Results A total of 10,534 subjects (65.9% males, mean age 68.3 years) who underwent CS (64.3% with prosthetic materials) were included, among which 533 SSIs were identified (mean incidence of 5.06%), with 430 cases (80.7%) occurring after discharge (38.7% deep SSI) and 103 (19.3%) before discharge (55.5% deep SSI). The trained XGBoost algorithm achieved an AUC of 0.62, sensitivity of 69%, and specificity of 50% in the prediction of SSI on the test dataset. Conclusions These findings suggest that while the XGBoost model provides a fair predictive capability, there is significant room for improvement in sensitivity and specificity. The use of artificial intelligence offers a promising opportunity to identify patients at risk of SSI. However, further research and comprehensive data are needed to refine the predictive model and effectively improve prevention measures. Key messages • Predominantly occurring post-discharge, SSIs in cardiac surgery necessitate enhanced prevention strategies, highlighting the critical phase after hospital discharge where surveillance is paramount. • Artificial intelligence may enhance post-discharge SSI surveillance, promising to identify patients at increased risk. Further research is needed to refine these AI tools for optimal sensitivity.