Abdulrahim Omar, 21, gave the boy a “number one” haircut after the boy had been playing with a razor which he claimed was dangerous.
The boy, who cannot be named for legal reasons, was then made to sweep up his hair from the floor while others watched and laughed, Luton Crown Court heard.
He felt so humiliated that he dialled 999 for the police, the court heard.
Omar, of Bedford, admitted to assault occasioning actual bodily harm on 18 February.
Judge Richard Foster said the punishment was the “most disgusting piece of humliation” and there was “no excuse for what you did”.
Alex Radley, representing the boy, said he suffered “psychological and physical harm”.
“The young man was proud of his hairstyle and felt that it was important to him,” he added.
Defending Omar, Ahtiq Raja said: “Mr Omar recognises he made a grave mistake.
“He is of previous good character and pleaded guilty at the first opportunity and is very, very sorry for his actions.
“He knows there is no excuse and knows what he has done is fundamentally wrong. The actions were a one-off.”
The judge said the offence was a “premeditated humiliation of a 10-year-old”.
“It was a despicable conduct to treat a child in that way,” he said.