Under France's strict secularism laws, the government does not keep statistics on people's religion or ethnicity.
But Robert Ménard, mayor of Béziers in the south of the country, said his administration had used lists of pupils' names to decide how many were Muslim, and claimed the figure came to 64.6 percent.
"Sorry to say this, but the town hall has, class by class, the names of the children," he said on France 2 television on Monday night.
"I know I don't have the right to do it. Sorry to say it, but the first names tell us their religion. To say otherwise is to deny the evidence," he added.
He added that there were schools where the "majority of mothers don't speak French".
His comments brought condemnation from the Socialist government, with Prime Minister Manuel Valls tweeting "shame on the mayor".
"The Republic does not make any distinction between its children," Valls said before adding that the scandal shows "the reality of the far-right".
French President François Hollande said keeping such a list was "against all the values of the Republic".
Education Minister Najat Vallaud-Belkacem said she had called for a judicial investigation, saying Menard's statements were "profoundly anti-Republican".
"I am scandalised, sickened by these comments," added Abdallah Zekri, head of the National Observatory Against Islamophobia.
"Moreover, you can be called Mohammed without being a practising Muslim," he added.
However the town hall of Béziers denied on Wednesday that there was any list of children's names or that any effort had been made to identify which were Muslim.
"The town hall of Béziers does not have, and has never had, files on its children," it said in a statement.
Police raided the town hall late on Tuesday afternoon to gather evidence.