Sounds like this teacher is struggling to learn how to handle a room full of kids so is picking on one or two in an attempt to maintain control...
Also sounds like he's a bit of a prick.
Tell your DS 'This is a great example of how some adults in some jobs ARE a bit of a prick, and you learn how to manage them without you looking like the prick. Given patience and handled right, it is possible that the whole world will see what a prick this person is but if you mess around and give him opportunities, it is you that looks like the dick...'
If it were ME in that class... I'd be an absolute fucking arsehole.
'Excuse me Sir, we're 5 laptops short. What would you like us to do to resolve this situation?'
'I'd like permission to get up and pass Fotherington-Thomas this pen, his appears to have run out.'
'Excuse me Sir, it is very chilly in here, please may I wear my coat?''
And of course resist the urge to laugh at silly noises, however he needs to go about that (I recommend entire tie in mouth).
I once said 'Excuse me sir, I'd like to take notes now, please don't think I am doodling or writing notes'.. as the previous time I had done this he'd snatched the pen and thrown it across the room (breaking it).
Got chucked out of the class for doodling and being cheeky, sent to head master with a note 'Widdlin is to show you what she was doodling in class'
Note to teacher from head ' Widdling has shown me a page of detailed notes on the class topic, stop wasting pupils time'.
Now to be fair, I knew he'd do that and i knew the head thought he was a complete bell end.. he did leave me alone after that! Sadly, I had been rooting for him to ask me to tell the class what the Head had said, as he had done to other pupils in the past... but he didn't.