Police records reveal the incident, which took place behind buses in the school's parking lot, came to light after the teacher spied the boys watching a video of the attack on a mobile phone, Gulf News reported Tuesday.
The teacher told the victim's father what happened and the father reported the matter to police.
Two of the seven schoolboys, both teenagers, are charged with rape while five others face molestation charges.
According to police, the teacher said the video recording of the incident showed the victim crying while he was being forced to perform indecent acts on his classmates.
All seven defendants have pleaded innocent to the charges.
The trial is being held in juvenile court in Dubai.
'SNL': 'Anchorman 2' cast, One Direction sing 'Afternoon Delight' [VIDEO]
Selena Gomez drops F-bomb, walks off stage during Jingle Ball performance