A labourer started selling cannabis in an effort to feed his own drug habit, a court heard.
Evan Louth (23) was found with cannabis and cannabis resin as well as a weighing scales and tick list.
His lawyer said Louth has never been in trouble before and was afraid of going to jail.
Judge David McHugh imposed a three-month sentence but suspended it for 18 months.
The defendant, with an address at Casement Road in Finglas, had admitted before Blanchardstown District Court to possession of cannabis and cannabis resin as well as having them for sale or supply.
The incident took place at Plunkett Road in Finglas on November 27 last year.
Louth also admitted to obstructing Garda Tom Murray under the drugs act, in that he discarded a quantity of drugs.
Sergeant Mary Doherty said gardai obtained a search warrant and during the course of a search they found cannabis and cannabis resin in a sitting room.
Sgt Doherty said officers also found a weighing scales and tick list of drug debts.
Defence barrister Ann Sheridan said Louth, a general operative, was using drugs at the time and was supplying cannabis to feed his own habit.
She said the defendant is no longer abusing drugs.
Ms Sheridan also said Louth was worried about going to jail and was willing to do anything the court asked him to do.
Imposing a suspended sentence, Judge McHugh said Louth had "all the paraphernalia" for supplying drugs and he was "very lucky to be walking out of court".