Background Atrial fibrillation (AF) is the most common, clinically relevant arrhythmia in adults and associated with ischemic stroke and premature death. However, data are conflicting on whether AF is independently associated with risk of dementia, particularly in diverse populations. Methods and Results We identified all adults from 2 large integrated health care delivery systems between 2010 and 2017 and performed a 1:1 match of incident AF: no AF by age at index date, sex, estimated glomerular filtration rate category, and study site. Subsequent dementia was identified through previously validated diagnosis codes. Fine-Gray subdistribution hazard models were used to examine the association of incident AF (versus no AF) with risk of incident dementia, adjusting for sociodemographics and comorbidity and accounting for competing risk of death. Subgroup analyses by age, sex, race, ethnicity, and chronic kidney disease status were also performed. Among 196 968 matched adults, mean (SD) age was 73.6 (11.3) years, with 44.8% women, and 72.3% White. Incidence rates (per 100 person-years) for dementia over a median follow-up of 3.3 (interquartile range, 1.7-5.4) years were 2.79 (95% CI, 2.72-2.85) and 2.04 (95% CI, 1.99-2.08) per 100 person-years in persons with versus without incident AF, respectively. In adjusted models, incident AF was associated with a significantly greater risk of diagnosed dementia (subdistribution hazard ratio [sHR], 1.13 [95% CI, 1.09-1.16]). With additional adjustment for interim stroke events, the association of incident AF with dementia remained statistically significant (sHR, 1.10 [95% CI, 1.07-1.15]). Associations were stronger for age <65 (sHR, 1.65 [95% CI, 1.29-2.12]) versus ≥65 (sHR, 1.07 [95% CI, 1.03-1.10]) years (interaction P<0.001); and those without (sHR, 1.20 [95% CI, 1.14-1.26]) versus with chronic kidney disease (sHR, 1.06 [95% CI, 1.01-1.11]; interaction P<0.001). No meaningful differences were seen by sex, race, or ethnicity. Conclusions In a large, diverse community-based cohort, incident AF was associated with a modestly increased risk of dementia that was more prominent in younger patients and those without chronic kidney disease but did not substantially vary across sex, race, or ethnicity. Further studies should delineate mechanisms underpinning these findings, which may inform use of AF therapies.