Abstract Background Heart failure (HF) and atrial fibrillation (AF) are intertwined, sharing common risk factors and influencing each other in a reciprocal manner. While left ventricular diastolic dysfunction (LVDD) stands as a hallmark of HF's hemodynamic profile, its direct correlation with heightened AF risk remains uncertain. Our recent validation of an artificial intelligence-enabled electrocardiogram (AI-ECG) algorithm for LVDD detection has opened new avenues. Yet, whether AI-ECG-detected LVDD correlates with long-term AF risk remains unexplored. Methods We performed a retrospective study among all patients with a comprehensive LVDD assessment from the test population of the AI-ECG LVDD study between September 2001 and June 2022. Patients with prior documented AF according to health records or previous ECG were excluded. Patients were classified by AI-ECG as normal diastolic function (DF), grade 1 (G1), grade 2 (G2), or grade 3 (G3) LVDD. We assessed the risk of AF across AI-ECG LVDD grade, with normal DF as reference, with competing risk models. Results Of 97,023 patients free of AF at baseline, 63,533 (65.4%), 10,776 (11.1%), 18,940 (19.5%), and 3,774 (3.9%) were classified as normal DF, G1-LVDD, G2-LVDD, and G3-LVDD, respectively. Worse AI-ECG LVDD was associated with older age, lower left ventricular ejection fraction (LVEF), and higher rates of HF, diabetes, hypertension, chronic pulmonary disease, renal failure, and cardiovascular disease (p-of-trend<0.001 for all). Over a median follow-up of 4.8 years (interquartile range 1.8-9.2 years), new-onset AF occurred in 6,795 (7.0%) patients. In multivariable survival analysis, adjusted to multiple risk factors including LVEF and clinical HF, G2 and G3 LVDD, representing patients with high filling pressures, were independently associated with a higher AF-risk [G2-LVDD: adjusted hazard ratio (aHR) 1.64 (95% confidence interval (95%CI) 1.52-1.73), G3-LVDD: aHR 2.24 (95%CI 2.02-2.48)]. Conclusion The AI-ECG LVDD algorithm independently predicts long-term AF risk, regardless of LVEF and clinical HF status, highlighting its potential for identifying high-risk populations and guiding proactive monitoring and management.