The fire broke out inside a classroom at Farmdale Elementary School on La Mesa and Winder Avenue.
Firefighters were alerted to the flames when a burglar alarm went off -- followed by a fire alarm.
The fire destroyed desks and books. Water damaged nearby classrooms and the library.
Investigators say a security camera caught the boys breaking onto campus.
Merced Fire Chief Mike McLaughlin said, "When something like that happens at a school, it's out of line. There's a certain type of behavior that would cause someone to take action toward of a school, which is what we're looking into at this time."
Police later arrested two 14-year-olds and a 10-year-old boy who attends the school. They say he was named as a person of interest following a previous problem at the campus.