They say the militants in pick-up trucks arrived in the town of Dapchi, Yobe state, on Monday evening, shooting and setting off explosives.
Alerted by the noise, staff and students were able to flee.
In April 2014, Boko Haram kidnapped more than 270 girls from a school in the north-eastern town of Chibok.
Residents and civilian militia in Dapchi say they believe the jihadists had planned to kidnap schoolgirls in their town too.
After finding the school empty, the militants looted the building.
They say that Nigeria's security forces - backed by military jets - later repelled the attack.
Last September, a group of more than 100 of the Chibok girls were reunited with their families at a party in the capital Abuja.
Most of the group were released in May as part of a controversial prisoner swap deal with the Nigerian government that saw five Boko Haram commanders released.
But more than 100 schoolgirls are still being held by Boko Haram, and their whereabouts are unknown.
Boko Haram militants have been fighting a long insurgency in their quest for an Islamic state in northern Nigeria. The conflict is estimated to have killed tens of thousands of people.
The Chibok girls represent a fraction of the women captured by the militant group, which has kidnapped thousands during its eight-year insurgency in northern Nigeria.
BBC
More about: BokoHaram