When teacher Deborah Meyer Kelso, 43, of Hagerstown, tried to escort him from the class, a fire alarm was pulled and she was punched in the jaw, deputies said.
In addition to second-degree assault, the youth admitted to destruction of property and making a false fire alarm.
The boy had a knife that he used to cut a phone cord and make threats with but never brandished, deputies said.
"The recommendation in December was for placement because he wasn't cooperating," said Washington County Assistant State's Attorney Susan Lochbaum.
He is now in therapy and there was a very positive report from that therapist, Lochbaum said.
"This is quite a surprise and a very pleasant surprise to see how well you are doing," McDowell said.
The judge said 30 days at the Noyes Detention Center in Rockville also may have helped change the teenager's attitude.
McDowell levied a suspended commitment to a youth facility and placed the teen on indefinite supervised probation.
Under terms of the probation, there is to be no alcohol or drug use and the boy must attend counseling, a victim awareness education program and school.
The teen is to perform 50 hours of community service and adhere to a curfew - 9 p.m. on week nights and 9:30 p.m. on weekends, the judge ordered.