Concerns exist that use of selective serotonin reuptake inhibitors (SSRIs) increases the risk of developing type 2 diabetes (T2D) in adults, but evidence in children and adolescents is limited. In the absence of a randomized clinical trial, evidence must be generated using real-world data. To evaluate the safety of SSRI use in children and adolescents with respect to the associated risk of T2D. This cohort study of patients aged 10 to 19 years with a diagnosis for an SSRI treatment indication was conducted within the nationwide Medicaid Analytic eXtract (MAX; January 1, 2000, to December 31, 2014) and the IBM MarketScan (January 1, 2003, to September 30, 2015) databases. Data were analyzed from November 1, 2018, to December 6, 2019. New users of an SSRI medication and comparator groups with no known metabolic adverse effects (no antidepressant exposure, bupropion hydrochloride exposure, or psychotherapy exposure). Within-class individual SSRI medications were compared with fluoxetine hydrochloride. Incident T2D during follow-up. Intention-to-treat effects were estimated using Cox proportional hazards regression models, adjusting for confounding through propensity score stratification. As-treated effects to account for continuous treatment were estimated using inverse probability weighting and marginal structural models. A total of 1 582 914 patients were included in the analysis (58.3% female; mean [SD] age, 15.1 [2.3] years). The SSRI-treated group included 316 178 patients in the MAX database (publicly insured; mean [SD] age, 14.7 [2.1] years; 62.2% female) and 211 460 in the MarketScan database (privately insured; mean [SD] age, 15.8 [2.3] years; 63.9% female) with at least 2 SSRI prescriptions filled, followed up for a mean (SD) of 2.3 (2.0) and 2.2 (1.9) years, respectively. In publicly insured patients, initiation of SSRI treatment was associated with a 13% increased hazard of T2DM (intention-to-treat adjusted hazard ratio [aHR], 1.13; 95% CI, 1.04-1.22) compared with untreated patients. The association strengthened for continuous SSRI treatment (as-treated aHR, 1.33; 95% CI, 1.21-1.47), corresponding to 6.6 (95% CI, 4.2-10.4) additional cases of T2D per 10 000 patients treated for at least 2 years. Adjusted HRs were lower in privately insured patients (intention-to-treat aHR, 1.01 [95% CI, 0.84-1.23]; as-treated aHR, 1.10 [95% CI, 0.88-1.36]). Findings were similar when comparing SSRI treatment with psychotherapy (publicly insured as-treated aHR, 1.44 [95% CI, 1.25-1.65]; privately insured as-treated aHR, 1.21 [95% CI, 0.93-1.57]), whereas no increased risk was observed compared with bupropion treatment publicly insured as-treated aHR, 1.01 [95% CI, 0.79-1.29]; privately insured as-treated aHR, 0.87 [95% CI, 0.44-1.70]). For the within-class analysis, no medication had an increased hazard of T2D compared with fluoxetine. These findings suggest that children and adolescents initiating SSRI treatment may be at a small increased risk of developing T2D, particularly publicly insured patients. The magnitude of association was more modest than previously reported, and the absolute risk was small. The potential small risk should be viewed in relation to the efficacy of SSRIs for its major indications in young patients.