ImportanceHigh-risk practices, including dispensing an opioid prescription before surgery when not recommended, remain poorly characterized among US youths and may contribute to new persistent opioid use.ObjectiveTo characterize changes in preoperative, postoperative, and refill opioid prescriptions up to 180 days after surgery.Design, Setting, and ParticipantsThis retrospective cohort study was performed using national claims data to determine opioid prescribing practices among a cohort of opioid-naive youths aged 11 to 20 years undergoing 22 inpatient and outpatient surgical procedures between 2015 and 2020. Statistical analysis was performed from June 2023 to April 2024.Main Outcomes and MeasuresThe primary outcome was the percentage of initial opioid prescriptions filled up to 14 days prior to vs 7 days after a procedure. Secondary outcomes included the likelihood of a refill up to 180 days after surgery, including refills at 91 to 180 days, as a proxy for new persistent opioid use, and the opioid quantity dispensed in the initial and refill prescriptions in morphine milligram equivalents (MME). Exposures included patient and prescriber characteristics. Multivariable logistic regression models were used to estimate the association between prescription timing and prolonged refills.ResultsAmong 100 026 opioid-naive youths (median [IQR] age, 16.0 [14.0-18.0] years) undergoing a surgical procedure, 46 951 (46.9%) filled an initial prescription, of which 7587 (16.2%) were dispensed 1 to 14 days before surgery. The mean quantity dispensed was 227 (95% CI, 225-229) MME; 6467 youths (13.8%) filled a second prescription (mean MME, 239 [95% CI, 231-246]) up to 30 days after surgery, and 1216 (3.0%) refilled a prescription 91 to 180 days after surgery. Preoperative prescriptions, increasing age, and procedures not typically associated with severe pain were most strongly associated with new persistent opioid use.Conclusions and RelevanceIn this retrospective study of youths undergoing surgical procedures, of which, many are typically not painful enough to require opioid use, opioid dispensing declined, but approximately 1 in 6 prescriptions were filled before surgery, and 1 in 33 adolescents filled prescriptions 91 to 180 days after surgery, consistent with new persistent opioid use. These findings should be addressed by policymakers and communicated by professional societies to clinicians who prescribe opioids.