Patients with early-onset atrial fibrillation (AF) are enriched for rare variants in cardiomyopathy and arrhythmia genes. The clinical significance of these rare variants in patients with early-onset AF is unknown. To assess the association between rare variants in cardiomyopathy and arrhythmia genes detected in patients with early-onset AF and time to death. This prospective cohort study included participants with AF diagnosed before 66 years of age who underwent whole-genome sequencing through the National Heart, Lung and Blood Institute's Trans-Omics for Precision Medicine program. Participants were enrolled from November 23, 1999, to June 2, 2015. Data were analyzed from February 26 to September 19, 2021. Rare variants identified in a panel of 145 genes that are included in cardiomyopathy and arrhythmia panels used by commercial clinical genetic testing laboratories. The primary study outcome was time to death and was adjudicated from medical records and the National Death Index. Multivariable Cox proportional hazards regression was used to evaluate the association of disease-associated variants with risk of death after adjustment for age at AF diagnosis, sex, race, body mass index, left ventricular ejection fraction, and an interaction term of age at AF diagnosis and disease-associated variant status. Among 1293 participants (934 [72%] male; median age at enrollment, 56.0 years; IQR, 48.0-61.0 years), disease-associated (pathogenic or likely pathogenic) rare variants were found in 131 (10%). During a median follow-up of 9.9 years (IQR, 6.9-13.2 years), 219 participants (17%) died. In univariable analysis, disease-associated variants were associated with an increased risk of mortality (hazard ratio, [HR], 1.5; 95% CI, 1.0-2.1; P = .05); the association remained significant in multivariable modeling when adjusted for age at AF diagnosis, sex, race, body mass index, left ventricular ejection fraction, and an interaction term between disease-associated variant status and age at AF diagnosis. The interaction demonstrated that disease-associated variants were associated with a significantly higher risk of mortality compared with no disease-associated variant when AF was diagnosed at a younger age (P = .008 for interaction). Higher body mass index (per IQR: HR, 1.4; 95% CI, 1.2-1.6; P < .001) and lower left ventricular ejection fraction (per IQR: HR, 0.8; 95% CI, 0.7-0.8; P < .001) were associated with higher mortality risk. There were 73 cardiomyopathy-related deaths, 40 sudden deaths, and 10 stroke-related deaths. Mortality among patients with the most prevalent genes with disease-associated variants was 26% (10 of 38 patients) for TTN, 33% (6 of 18) for MYH7, 22% (2 of 9) for LMNA, 0% (0 of 10) for MYH6, and 0% (0 of 8) for KCNQ1. The findings suggest that rare variants in cardiomyopathy and arrhythmia genes may be associated with increased risk of mortality among patients with early-onset AF, especially those diagnosed at a younger age. Genetic testing may provide important prognostic information for patients with early-onset AF.