Background: New-onset postoperative atrial fibrillation (POAF) is the most common complication following cardiac surgery, associated with adverse outcomes. However, the predictive accuracy of existing models remains unsatisfactory, primarily due to insufficient utilization of electrocardiogram (ECG) data and limitations in model development methodologies. This study aims to develop an accurate prediction model for POAF by comprehensively analyzing the predictive power of various preoperative ECG features. Methods: This study enrolled 92 cardiac surgery patients with no prior history of atrial fibrillation (AF). One-minute ECG segments, extracted from preoperative long-term ECG recordings, were analyzed for P-wave and short-term heart rate variability (HRV) characteristics. A total of 39 HRV indices and 9 P-wave indices were calculated as ECG features. Additionally, clinical baseline characteristics were incorporated into a multi-modal risk assessment model. Using various feature combinations, six machine learning classifiers were applied to assess the predictive efficacy of various models. Finally, an ensemble strategy was implemented to enhance the model's prediction performance for POAF. Results: Statistical analysis revealed significant differences (p < 0.05) in 15 ECG features between patients with POAF and those without, including RR interval unpredictability and the cardiac sympathetic index. The predictive model based solely on clinical baseline characteristics demonstrated high accuracy (78.26 %), sensitivity (78.57 %), and specificity (78.13 %), with superior sensitivity in identifying patients at high risk for POAF compared to existing models. Furthermore, the multi-modal model, which integrated preoperative ECG features and an ensemble machine learning (EML) strategy, demonstrated a significant improvement in prediction performance, with an average accuracy of 81.52 %, sensitivity of 82.14 %, and specificity of 81.25 %. Conclusion: The integration of P-wave and short-term HRV features holds promise for improving the prediction of new-onset POAF. ECG-assisted analysis is a valuable tool for elucidating the underlying mechanisms of POAF and advancing clinical strategies for its prevention and management.