Abstract Introduction Atrial fibrillation (AF) is a common cardiac arrhythmia associated with an increased risk of stroke, heart failure and premature death. Genetic associations between AF and rare variants have been identified in several cardiomyopathy-associated genes, and previous studies have shown a high prevalence of deleterious variants among individuals with early onset of AF. Consequently, genetic testing has been suggested in patients with AF onset before 45 years of age. Purpose This study aimed to explore the prevalence and distribution of deleterious genetic variants in cardiomyopathy genes according to age at AF diagnosis. Methods The UK Biobank is a large population-based biobank, comprised of clinical and genetic information on more than 500,000 individuals, enrolled between 2006 and 2010. We analyzed whole-exome sequencing data among unrelated individuals of European ancestry. The cohort was stratified by age at AF onset (AF onset <45 years, AF onset between 45-54 years, AF onset between 55-64 years, AF onset >=65 years, and individuals with no AF diagnosis). We evaluated the presence of rare (minor allele frequency <0.1%) genetic variants in core cardiomyopathy genes, according to guidelines by the American College of Medical Genomics and focused on variants predicted to lead to loss of function. Individuals with a diagnosis of cardiomyopathy prior to AF were excluded. Results Among 374,365 unrelated individuals of European ancestry, 29,119 were diagnosed with AF. Of these, 685 had onset of AF<45 years (2.35%), 2465 had onset between 45-54 years (8.46%), 7778 had onset between 55-64 years (26.71%), and 18191 had onset at or above 65 years of age (62.48%). A total of 884 were carriers of rare loss-of-function variants in cardiomyopathy genes. Among carriers, the majority of variants were in key genes for dilated cardiomyopathy (TTN), hypertrophic cardiomyopathy (MYBPC3), and arrhythmogenic right ventricular cardiomyopathy (PKP2). We observed an inverse dose-response-like relationship between prevalence of the rare genetic variants and age at AF diagnosis. The highest prevalence of carriers was observed among individuals with onset before 45 years (4.96%). In comparison, the proportion of carriers was 3.45% in individuals with AF onset between 45-54 years, 2.96% in individuals with AF onset between 55-64 years, 2.75% in individuals with onset at or after 65 years, and 2.05% among individuals without AF diagnosis. Conclusions Using whole exome sequencing, we identified a high proportion of carriers of deleterious variants in actionable genes of cardiomyopathies among individuals with early onset of AF. We observed an inverse dose-response-like relationship between age of AF diagnosis and prevalence of deleterious genetic variants. Our findings support that very early onset of AF, before 45 years of age, is a potential risk marker for cardiomyopathy and support that genetic screening may be relevant in this patient group.