Horribly unfair! What was lost on the teacher was that you received the majority of votes so, if you’d been allowed to lead, the rebelling boys would have been in the minority. She was probably wrong about that anyway.
Perfectly normal for boys that age to seek out other boys and not want to be bossed by females. They are learning about their identities.
Sex-segregated classes are so much better for youngsters in that age group.