The 15-year-old wounded the teacher slightly with a machete during the attack in the southern city of Marseille before being stopped.
The teacher was left with an injured shoulder and hand.
Militants said to be from IS killed 130 people in attacks in the capital Paris less than two months ago.
Interior Minister Bernard Cazeneuve called the new attack a "revolting anti-Semitic aggression" while French President Francois Hollande later said such acts were "unspeakable and unjustifiable".
"[The teenager] claimed to have acted in the name of Allah and the Islamic State, repeating several times to have done [it] on behalf of Daesh [Islamic State]," the prosecutor, Brice Robin, told a news conference.
The teen is said to be a good student who previously showed no signs of radicalisation.
An attack by an IS supporter in Paris last January targeted a Jewish supermarket, where four people were killed, shortly after the deadly assault on the office of Charlie Hebdo magazine.
Since then, more than 700 synagogues, Jewish schools and community centres have been protected by police or soldiers.
A Turkish Kurd teenager who attacked a Jewish teacher in France said he was acting in the name of the Islamic State (IS) group, a prosecutor says.