AimsWhile electrocardiogram (ECG) characteristics have been associated with life-threatening ventricular arrhythmias (LTVA) in dilated cardiomyopathy (DCM), they typically rely on human-derived parameters. Deep neural networks (DNNs) can discover complex ECG patterns, but the interpretation is hampered by their ‘black-box’ characteristics. We aimed to detect DCM patients at risk of LTVA using an inherently explainable DNN.Methods and resultsIn this two-phase study, we first developed a variational autoencoder DNN on more than 1 million 12-lead median beat ECGs, compressing the ECG into 21 different factors (F): FactorECG. Next, we used two cohorts with a combined total of 695 DCM patients and entered these factors in a Cox regression for the composite LTVA outcome, which was defined as sudden cardiac arrest, spontaneous sustained ventricular tachycardia, or implantable cardioverter-defibrillator treated ventricular arrhythmia. Most patients were male (n = 442, 64%) with a median age of 54 years [interquartile range (IQR) 44–62], and median left ventricular ejection fraction of 30% (IQR 23–39). A total of 115 patients (16.5%) reached the study outcome. Factors F8 (prolonged PR-interval and P-wave duration, P < 0.005), F15 (reduced P-wave height, P = 0.04), F25 (increased right bundle branch delay, P = 0.02), F27 (P-wave axis P < 0.005), and F32 (reduced QRS-T voltages P = 0.03) were significantly associated with LTVA.ConclusionInherently explainable DNNs can detect patients at risk of LTVA which is mainly driven by P-wave abnormalities.