Evidence indicates that in utero exposure to chorioamnionitis might increase the risk of neurodevelopmental disorders in the offspring. However, findings on this topic have been inconsistent. To examine the association between chorioamnionitis and neurodevelopmental disorders in offspring. This was a retrospective population-based cohort study in Sweden. A total of 2,228,280 singleton live births and stillbirths between 1998 and 2019 were included in our study population. Data on maternal characteristics and neurodevelopmental disorders in offspring were obtained by individual record-linkages of nationwide Swedish registries. Chorioamnionitis was identified using the National Medical Birth Register. Inpatient and outpatient diagnoses were obtained for cerebral palsy, autism, attention deficit hyperactivity disorder, epilepsy, and intellectual disability. Multivariable Cox proportional hazards regression was used to estimate the association between chorioamnionitis and each neurodevelopmental disorder with adjusted hazard ratios and 95% confidence intervals. A causal mediation analysis of the relationship between chorioamnionitis and neurodevelopmental disorders with preterm delivery (<37 weeks) was performed. A total of 5770 (0.26%) offspring were exposed to chorioamnionitis during pregnancy. During the study's follow-up time there were 4752 (0.21%) cases of cerebral palsy, 17,897 (0.80 %) cases of epilepsy, 50,570 (2.27 %) cases of autism, 114,087 (5.12%) cases of attention deficit hyperactivity disorder, and 14,574 (0.65%) cases of intellectual disability. After adjusting for potential confounders, exposure to chorioamnionitis increased the hazard ratios of cerebral palsy (adjusted hazard ratio, 7.43; 95% confidence interval, 5.90-9.37), autism (adjusted hazard ratio, 1.43; 95% confidence interval, 1.21-1.68), attention deficit hyperactivity disorder (adjusted hazard ratio, 1.17; 95% confidence interval, 1.03-1.33), and intellectual disability (adjusted hazard ratio, 1.99; 95% confidence interval, 1.53-2.58), whereas chorioamnionitis was not significantly associated with higher rates of epilepsy in offspring. Mediation analysis revealed that these associations were mainly explained through preterm delivery; however, increased risk was also observed among term infants. Chorioamnionitis increases the risk of neurodevelopmental disorders, particularly cerebral palsy, autism, attention deficit hyperactivity disorder, and intellectual disability. These associations were mainly mediated through preterm delivery. Efforts for timely identification and appropriate interventions to treat infections during pregnancy will have sustained benefits in reducing the burden of neurologic complications in children at the population level.