Education minister Mohammad Bathaei said a team of specialists had been appointed to trace the source of the videos, featuring the music of US-Iranian rapper Sasy.
“The enemy is trying different ways to create anxiety among the people including by spreading these disturbing videos,” he said.
“I’m certain there’s some kind of political plot behind the publication of these devious clips in schools.”
Several clips of dancing children were also posted by the singer on his own Instagram page in defiance of the criticism from hardline conservatives in parliament.
After deputy speaker Ali Motahari called for the headteachers of the schools to be sacked, Sasy invited the politician to take part in the challenge before suggesting that he should focus on more important issues.
“Seriously, you left the dollar, meat, high prices... and decided about “Gentleman”?, wrote the singer, who has more than 2 million followers.
Another cabinet member, Tadbir Wamid, claimed the videos were “causing concern and disturbance of people’s beliefs about education”.
“It’s unclear exactly where the clips are, and how it is made,” he said. “That’s why we need the honourable prosecutor, as well as the cyberpolice, on the source and release of the clips.”
Ayatollah Abbas Ka’bi, a member of the Iran’s Guardian Council of the Constitution, also called for school officials to be prosecuted, claiming the videos were “part of the enemy’s cultural war” against Iran.
In another post on Saturday morning, Sasy responded: “Did not you think about one day talking about Friday prayers? This song is listened to once in school and thousands of times in homes... get to the big trouble of the country.”
Iran’s judiciary and security forces are dominated by hardliners who launch periodic crackdowns on behaviour considered un-Islamic.
In 2014, seven Iranians were sentenced to six months in prison and 91 lashes, suspended for three years, for dancing in their homemade version of the Pharrell song “Happy”.
Last year an Iranian teenager posted videos of herself dancing in her bedroom. Maedeh Hojabri, an 18-year-old gymnast, was forced to issue an apology on state TV.
The education minister said that the investigation into the latest videos would ensure that “public trust and beliefs of the religious people in relation to the education system are not compromised”.
He added that arrangements would be made to “strengthen prayer” in schools, adding: “The only thing that can save students from dangers is prayers in schools.”