Emergency services were called to a report of a potentially hazardous substance in Coaltown of Balgonie on Sunday afternoon.
Five appliances in total were mobilised to Coaltown of Balgonie Primary School after the alarm was raised by a passer-by at around 1.30pm.
Two fire engines from Glenrothes and one from Kirkcaldy were called, and they were joined by specialist crews from Dunfermline and Edinburgh as a precaution.
Fire personnel also blocked off the narrow School Road, which runs up to the school gates, as investigations got under way, but it quickly became apparent that there was no danger to the public.
The substance found was some kind of coloured dye used by Scottish Water in searching for leaks in the system, with the dye spotted near a septic tank serving the school.
Firefighters washed down the road and most had left the scene by 3pm.
Local councillor Ian Sloan said: “This was a scare that could have been avoided with better communications from Scottish Water.
“I am only glad that there is no toxic chemical spillage and the children can return to Coaltown Primary School knowing that it is safe.”
The school is expected to open as normal this week.