Hundreds of gunmen initially attacked a lightly guarded military outpost at dawn, with many withdrawing but about 30 then taking over the school and using civilians as human shields, the military said.
"As of now they are in the school holding the civilians. They are using them as human shields," Captain Arvin Encinas, spokesman for the army division with responsibility for the area, told AFP over the phone.
He said the gunmen had planted improvised bombs around the school.
Captain Encinas said he did not know how many hostages had been taken, or if they included children.
The unrest occurred in Pigkawayan, a farming town about 160 kilometres (100 miles) from Marawi city where fighters linked to the ISIS group have been battling troops for a month in a conflict that has claimed hundreds of lives.
Armed forces spokesman Restituto Padilla earlier said the attackers on Wednesday belonged to the Bangsamoro Islamic Freedom Fighters (BIFF), one of four groups in the southern Philippine region of Mindanao that have pledged allegiance to ISIS.
Local police said the BIFF attack may have been intended to help the terrorists in Marawi by distracting the military.
Mr Padilla said the gunmen attacked the outpost at daybreak, then exchanged fire with troops in the morning before retreating in a hit-and-run assault typical of BIFF fighters.
"It's already resolved. The enemy has withdrawn... they failed," Mr Padilla said late on Wednesday morning.
However about six hours later Captain Encinas reported the hostage crisis at the school. Mr Padilla then appeared on television and confirmed terrorists were occupying the school.
Captain Encinas and Mr Padilla said there had also been skirmishes throughout the day outside of Pigkawayan, which is surrounded by marshlands, mountains and farmlands.
Pigkawayan mayor Eliseo Garsesa said about 200 gunmen were involved in the initial assault.
- Hardline groups -
Muslim rebels have been fighting for more than four decades for an independent or autonomous region in the south of the mainly Catholic nation, with the conflict claiming more than 120,000 lives.
The major rebel organisations have signed, or are pursuing, peace deals with the government, but small hardline groups such as the BIFF have vowed to continue fighting.
Philippine President Rodrigo Duterte declared martial law across Mindanao on May 23 immediately after fighters flying the ISIS flag rampaged through Marawi.
Their assault on Marawi ignited an unprecedented urban war that has claimed hundreds of lives and which Duterte has warned is part of an ISIS campaign to establish a base in Mindanao.
The fighting has left Marawi, the most important Muslim city in the Philippines, largely in ruins.
The terrorists involved in the Marawi fighting are mostly from the Maute and Abu Sayyaf organisations, which have united with the BIFF under the ISIS umbrella, according to the government.
The military has said foreign fighters, including those from Chechnya, Indonesia and Malaysia, have also joined the Marawi conflict.
ISIS has ambitions of setting up a caliphate in Southeast Asia -- home to largely Muslim nations like Indonesia and Malaysia -- as the group loses territory in Iraq and Syria.
The BIFF was blamed for attacking at least nine Mindanao towns in 2008, with the assaults claiming about 400 lives and forcing 600,000 people to flee their homes.