A Seat Leon being driven by Kessar Naveed, 27, was stopped in Morley on September 18, 2021, after it was spotted running a red light.
When officers approached Naveed, they immediately noticed a smell of cannabis - with his eyes also "bloodshot and glazed", prosecutor Adam Keenaghan told Leeds Crown Court.
The car Naveed was driving was searched and officers recovered and seized nitrous oxide canisters, balloons and a quantity of cannabis.
Naveed, of Squirrel Hall Drive, Dewsbury, failed a roadside drugs test and was arrested.
He was charged with possession of a psychoactive substance with intent to supply, possession of cannabis and driving while under the influence of drugs.
In mitigation, Safter Salam said Naveed's offending came "out of boredom and a lack of structure in his life".
He told the court the Covid pandemic had put a stop to Naveed's plans to become a personal trainer.
Naveed has 12 previous convictions for 33 offences, the court was told.
He had previously been disqualified from driving in 2014 and received a significant sentence of 110 months in a youth offender institute for an aggravated burglary offence.
His most recent conviction was in 2017.
Naveed pleaded guilty at a pre-trial preparation hearing on May 3.
Sentencing Naveed, Recorder Christopher Rose said: "A vehicle you were driving was stopped by police.
"They had noticed your vehicle when it had run a red light.
"To your credit you did stop, but they immediately smelled cannabis on you and took the view you were under the influence of cannabis
"They found a quantity of nitrous oxide canisters in the rear of the vehicle and bags of balloons.
"They also found within your drivers side door two small bags of cannabis and when ultimately you had a blood test taken you were found to be over the legal limit for cannabis."
Naveed was given a six month custodial sentence, suspended for 18 months.
He was also ordered to do 20 rehabilitation days and complete 200 hours of unpaid work.
"You have frankly a poor record of previous offending particularly involving driving", Recorder Rose continued.
"That includes driving under the influence.
"That is a pattern of behaviour that has continued.
"This is not offending which is so serious only immediate custody can be justified.
"On the basis of the pre sentence report I have read and the positive progress you have made since 2017, and what that report tells me in terms of your lifestyle and your efforts to keep out of trouble in terms of gym work, it leads me to conclude there is a realistic prospect of rehabilitation."
The recorder also ordered forfeiture of all drugs and paraphernalia seized by the police from the car.
Recorder Rose concluded: "If you breach any of the requirements or commit any further offences in the lifetime of that order you will have to come back to this court
"I hope you don't come back and use this as an opportunity to turn your life around and build on the positive progress you have been making since 2017."