Prenatal diet may be causally related to autism; however, findings are inconsistent, with a limited body of research based on small sample sizes and retrospective study designs. To investigate the associations of prenatal dietary patterns with autism diagnosis and autism-associated traits in 2 large prospective cohorts, the Norwegian Mother, Father, and Child Cohort Study (MoBa), and the Avon Longitudinal Study of Parents and Children (ALSPAC). This cohort study used data from MoBa and ALSPAC birth cohort studies conducted across Norway and in the Southwest of England, respectively. Participants were people with singleton pregnancies with self-reported food frequency questionnaire responses. MoBa recruited between 2002 and 2008, and ALSPAC recruited between 1990 and 1992, and children were followed-up until age 8 years or older. Recruitment rates were 41% (95 200 of 277 702 eligible pregnancies) in MoBa and 72% (14 541 of 20 248 eligible pregnancies) in ALSPAC. Data analysis occurred February 1, 2022, to August 1, 2023. A healthy prenatal dietary pattern was derived using factor analysis and modeled as low, medium, and high adherence. In MoBa, the offspring outcomes were autism diagnosis and elevated social communication questionnaire score at ages 3 years and 8 years, with further analysis of the social communication difficulties and restrictive and repetitive behaviors subdomains. In ALSPAC, offspring outcomes were elevated social communication difficulties checklist score at age 8 years. Odds ratios (ORs) were estimated using generalized nonlinear models. MoBa included 84 548 pregnancies (mean [SD] age, 30.2 [4.6] years; 43 277 [51.2%] male offspring) and ALSPAC had 11 760 pregnancies (mean [SD] age, 27.9 [4.7] years; 6034 [51.3%] male offspring). In the final adjusted models, high adherence to a healthy dietary pattern, compared with low adherence, was associated with reduced odds of autism diagnosis (OR, 0.78; 95% CI, 0.66-0.92) and social communication difficulties at age 3 years in MoBa (OR 0.76, 95% CI, 0.70-0.82) and age 8 years in ALSPAC (OR, 0.74; 95% CI, 0.55-0.98). There was no consistent evidence of association with the other outcomes. In this cohort study of mother-child dyads, adherence to a healthy prenatal dietary pattern was associated with a lower odds of autism diagnosis and social communication difficulties but not restrictive and repetitive behaviors.