Ciaran McCormack, 27, from Lurgy, Letterkenny, pleaded guilty before the District Court in the town.
He was arrested by gardai on the Port Road in Letterkenny on August 22 last.
Judge Paul Kelly said he had been concerned that McCormack had been “attempting to minimise your role in the offences” during a meeting with probation officers.
“This is of some concern; you were supplying drugs and they are serious offences. There was a substantial amount of money involved in this case.”
However the judge said McCormack had belatedly acknowledged his actions and the probation service said he was suitable for community service.
He imposed a nine month prison sentence but substituted 180 hours community service. He was also fined €150.