Judge Michael Stokes QC said: "Common sense has prevailed now we have heard all the evidence."
Turning to Harvey, the judge said: "I'm not going to send you to prison for this offence.
"I'm not even going to impose a suspended sentence.
"That would be wrong given that you have already served a sentence longer than can be lawfully suspended."
He added: "This court is looking to impose a community order which will assist you with the problems that you have had."
After the attack Harvey, who had just gone back to work after several months off with stress, told police he thought he had killed the boy.
Transcripts of an interview with detectives were read out in court.
Harvey said: "I can't remember it too well but I do recall it was like watching it on television, like it was not actually happening to me.
"I can remember the boy swearing and when that happened I was not really there."
Harvey added: "We went through the door into the prep room and I remember standing over him with this metal weight and I remember hitting him twice.
"Something happened and I'm sure I dropped it. I remember feeling really peaceful."
Harvey bowed his head as the jury of six men and six women returned its unanimous verdict of not guilty.
The case 'was extremely complicated', police said
After hearing the judge's comments, he left by a side exit and will return to court to be sentenced for grievous bodily harm on 21 May.
Afterwards, Ch Insp Paul Winter, of Nottinghamshire Police, described the investigation as "extremely complicated", needing to be handled in a "highly sensitive way by officers with specialist skills."
He added: "We acknowledge the decision of the jury and hope that today's verdict will bring some degree of closure to all those involved and allow them to move on with their lives."
Rob Skelton of Nottinghamshire County Council said: "This was a very difficult case but it was highly unusual.
"Schools are normally very safe places. What occurred was out of the ordinary and totally unexpected, particularly in this school which enjoys a good reputation locally."
He added that the governing body of All Saints School would now deal with Mr Harvey's employment issues under its own internal procedures.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.