Background: Cannabis use may impair cognitive function (CF) differently in men and women, due to sex-specific differences in neurobiological mechanisms and environmental risk factors. Objective: Assess sex differences in the association between cumulative exposure to cannabis and cognitive performance in middle age. Methods: We studied participants from the Coronary Artery Risk Development in Young Adults (CARDIA) Study, including Black and White men and women 18-30 years old at baseline followed over 30 years. Our cross-sectional analysis of CF scores at year 30 was stratified by sex. We computed categories of cumulative exposure in “cannabis-years” (1 cannabis-year=365 days of use) from self-reported use every 2 to 5 years over 30 years. At years 25 and 30, we assessed CF with the Rey Auditory Verbal Learning Test (verbal memory), the Digit Symbol Substitution Test (processing speed), and the Stroop Interference Test (executive function). At year 30, additional measures included Category and Letter Fluency Test (verbal ability) and the Montreal Cognitive Assessment (global cognition). We computed standardized scores for each cognitive test and applied multivariable adjusted linear regression models for self-reported cumulative cannabis use, excluding participants who used cannabis within 24 h. In a secondary analysis, we examined the association between changes in current cannabis use and changes in CF between years 25 and 30. Results: By year 30, 1,352 men and 1,793 women had measures of CF; 87% (N=1,171) men and 84% (N=1,502) women reported ever cannabis use. Men had a mean cumulative use of 2.57 cannabis-years and women 1.29 cannabis-years. Self-reported cumulative cannabis use was associated with worse verbal memory in men (e.g., -0.49 standardized units [SU] for ≥5 cannabis-years of exposure; 95% CI=-0.76 to -0.23), but not in women (SU=0.02; 95% CI=-0.26 to 0.29). Other measures of CF were not associated with cannabis. Changes in current cannabis use between years 25 and 30 were not associated with CF in men or women. Conclusions: Self-reported cumulative cannabis exposure was associated with worse verbal memory in men but not in women. Researchers should consider stratified analyses by sex when testing the association between cannabis and cognition.