Rheumatoid arthritis (RA) has been associated with an elevated dementia risk. This study aimed to examine how different diagnostic dementia definitions perform in patients with RA compared to individuals without RA. The study population included 2050 individuals (1025 with RA) from a retrospective, population-based cohort in southern Minnesota and compared the performance of 3 code-based dementia diagnostic algorithms with medical record review diagnosis of dementia. For the overall comparison, each patient's complete medical history was used, with no time frames. Sensitivity analyses were performed using 1-, 2-, and 5-year windows around the date that dementia was identified in the medical record (reference standard). Algorithms performed very similarly in persons with and without RA. The algorithms generally had high specificity, negative predictive values, and accuracy, regardless of the time window studied (> 88%). Sensitivity and positive predictive values varied depending on the algorithm and the time window. Sensitivity values ranged 56.5-95.9%, and positive predictive values ranged 55.2-83.1%. Performance measures declined with more restrictive time windows. Routinely collected electronic health record (EHR) data were used to define code-based dementia diagnostic algorithms with good performance (vs diagnosis by medical record review). These results can inform future studies that use retrospective databases, especially in the same or a similar EHR infrastructure, to identify dementia in individuals with RA.