Shaquille Harvey was also found to have cocaine, ketamine and MDMA hidden in his underwear when he was searched.
Leeds Crown Court heard police signalled for Harvey to stop his car in the Headingley area of Leeds after they saw him going through a red light.
Jessica Randall, prosecuting, said Harvey's car was full of passengers and the vehicle smelled of cannabis.
The car was searched and police found the cannabis in the compartment of a fake Monster energy drink can.
Miss Randall said officers also recovered two mobile phones from the teenager.
A text message came through to one of the phones at the time of the incident which requested a supply of drugs.
Harvey was searched and 16 wraps of cocaine, ketamine and MDMA worth £390 was found in his underwear.
The 18-year-old was also in possession of £340 in cash.
Harvey, of Hamilton Gardens, Chapeltown, pleaded guilty to possession of cannabis, cocaine and ketamine with intent to supply and possession of criminal property.
Imran Khan, mitigating, said Harvery had no previous convictions and was aged 17 at the time of the offences, on February 17.
Harvey was given a two year custodial sentence, suspended for two years.
He was also ordered to do 160 hours of unpaid work and take part in a 15-day rehabilitation activity requirement.
Judge Rodney Jameson QC told the defendant he was able to impose a suspended sentence as he had no previous convictions and was aged 17 at the time.
He said: "You do not need me to tell you how daft this was.
"If you do this again as an adult you know how substantial the prison sentences can be."