ImportanceMental health (MH) issues in children with cerebral palsy (CP) are poorly understood compared with other pediatric populations.ObjectiveTo examine MH diagnosis code assignment among children and young adults with CP and compare with typically developing (TD) and chronic condition (CC) pediatric populations.Design, Setting, and ParticipantsThis case-control study used International Statistical Classification of Diseases, Tenth Revision, Clinical Modification (ICD-10-CM) codes to create a CP case set and CC and TD control sets using electronic health record data of children and young adults from a large tertiary care children’s hospital in the midwestern United States between 2010 and 2022. Case-control matching was performed to control for demographic factors. Data were analyzed from June to December 2023.ExposuresAll MH diagnosis codes were mapped to ICD-10-CM and categorized using Clinical Classifications Software Refined (CCSR).Main Outcomes and MeasuresThe incidence rates of MH CCSR categories were calculated. Descriptive and comparative statistics were used to evaluate the significance and odds associated with factors.ResultsData from 216 794 individuals (mean [SD] baseline age, 4.3 [5.1] years; 118 562 [55%] male) were analyzed, including 3544 individuals with CP, 142 160 individuals with CC, and 71 080 TD individuals. The CP cohort spread across Gross Motor Function Classification System (GMFCS) levels I (981 individuals [28%]), II (645 individuals [18%]), III (346 individuals [10%]), IV (502 individuals [14%]), and V (618 individuals [17%]). Rates varied significantly for anxiety (824 individuals with CP [23%]; 25 877 individuals with CC [9%]; 6274 individuals with TD [18%]), attention-deficit/hyperactivity disorder (534 individuals with CP [15%]; 22 426 individuals with CC [9%]; 6311 individuals with TD [16%]); conduct or impulse disorder (504 individuals with CP [14%]; 13 209 individuals with CC [5%]; 3715 individuals with TD [9%]), trauma or stress disorders (343 individuals with CP [10%]; 18 229 individuals with CC [8%]; 5329 individuals with TD [13%]), obsessive-compulsive disorder (251 individuals with CP [7%]; 3795 individuals with CC [1%]; 659 individuals with TD [3%]), depression (108 individuals with CP [3%]; 12 224 individuals with CC [5%]; 4007 individuals with TD [9%]), mood disorders (74 individuals with CP [2%]; 4355 individuals with CC [2%]; 1181 individuals with TD [3%]), and suicidal ideation (72 individuals with CP [2%]; 7422 individuals with CC [5%]; 3513 individuals with TD [5%]). There was significant variation in odds of MH diagnoses by GMFCS level (I-II vs III-V: odds ratio [OR], 1.23; 95% CI, 1.09-1.40; P = .001). Among individuals with CP, males were more likely than females to have diagnosis codes for conduct or impulse disorders (OR, 1.41; 95% CI, 1.16-1.73) and attention-deficit/hyperactivity disorder (OR, 1.41 [95% CI, 1.15-1.73]). Black individuals, compared with White individuals, were more likely to have diagnoses for obsessive-compulsive disorder (OR, 1.57 [95% CI, 1.14-2.16]), other mood disorders (OR, 1.85 [95% CI, 1.01-3.38]), and trauma or stress disorders (OR, 1.94 [95% CI, 1.44-2.63]). Odds for trauma or stress disorders were elevated for individuals who identified as other races compared with White individuals (OR, 2.80 [95% CI, 2.03-3.87]).Conclusions and RelevanceIn this case-control study of children and young adults with CP and matched comparisons, anxiety and conduct or impulse diagnoses were higher in individuals with CP. The lower diagnosis rates of depression and suicidal ideation may indicate underdiagnosis among individuals with CP. There is likely a need for assessment tools that are more suitable for children with CP.