Adolescents with attention-deficit/hyperactivity disorder (ADHD) are at increased risk of developing substance use disorders (SUDs) and nicotine dependence (ND). It remains unclear whether and how stimulant treatment may affect this risk. We aimed to investigate how stimulant use profiles influence the risk of SUDs and ND, using a novel data-driven community detection analysis to construct different stimulant use profiles. Comprehensive lifetime stimulant prescription data and data on SUDs and ND were available for 303 subjects with ADHD and 219 controls, with a mean age 16.3 years. Community detection was used to define subgroups based on multiple indicators of treatment history, start age, treatment duration, total dose, maximum dose, variability, stop age. In stimulant-treated participants, three subgroups with distinct medication trajectories were distinguished (late-and-moderately dosed, n = 91; early-and-moderately dosed, n = 51; early-and-intensely dosed, n = 103). Compared to stimulant-naïve participants (n = 58), the early-and-intense treatment group had a significantly lower risk of SUDs and ND (HR = 0.28, and HR = 0.29, respectively), while the early-and-moderate group had a significantly lower risk of ND only (HR = 0.30). The late-and-moderate group was at a significantly higher risk of ND compared to the other two treatment groups (HR = 2.66 for early-and-moderate, HR = 2.78 for early-and-intense). Our findings show that in stimulant-treated adolescents with ADHD, long-term outcomes are associated with treatment characteristics, something that is often ignored when treated individuals are compared to untreated individuals.