John Maunder, 18, of Hermitage Close, Bishop’s Waltham, admitted being concerned in the supply of the class B drug between June 25 and September 13 last year.
He also admitted possession.
Portsmouth magistrates said he played a significant role but has a realistic prospect of rehabilitation, is young and took into account Covid-19.
Magistrates imposed an eight-month term suspended for a year. He must pay £225 costs and do 150 hours’ unpaid work.
Ethan Swann, 19, of Marlow Road in the village, admitted being concerned in supply and must do 120 hours’ unpaid work under a community order with £175 costs.