Thomas David Ball, 30, who held a senior role at Queen Ethelburga's, also downloaded vile images from the internet of young children being raped, bound and tortured.
The fee-paying day-and-boarding school is between York and Boroughbridge.
York Crown Court heard that Ball became “infatuated” with the pupil, a teenage boy who cannot be named for legal reasons.
Ball “hunted” for social-media snaps of the victim and made “29 separate (Google) searches” for the boy about a month before the spycam incident, said prosecutor Paul Newcombe.
He said that Ball had installed the camera, which he bought on Amazon, in a bathroom at the school.
The boy had just returned from registration when Ball asked him to take a shower. While showering, the boy noticed wires beneath the sink which were connected to a spy camera whose lights were on to show it was active.
Mr Newcome said the boy trusted Ball enough to hand him the camera. Ball then took it away, “no doubt to dispose of (the 15-minute video footage)”.
The boy, who was suspicious, informed his mother and Ball - who had just been promoted to a role overseeing pupils’ wellbeing and monitoring - later admitted to the school’s deputy safeguarding leader that he had made a “stupid mistake”. He handed the camera to a staff member.
The school reported the matter to police but before officers arrived, Ball went to his room, telling staff he was going to “retrieve something”.
In fact, he was trying to “conceal evidence” by hiding a second spy camera, a tablet and a memory stick in his car boot.
On the tablet were a cache of sickening images of children, including videos showing the rape and torture of very-young children.
Police found Ball’s fingerprints on the spy camera’s memory card and on the device itself. Despite this, he denied he was behind the covert footage of the naked boy and tried to blame other staff members.
“Other members of staff had to be interviewed and questioned,” said Mr Newcombe.
This had caused great “stress and upset and disruption to the school”, added the prosecutor.
Police forensic officers examined Ball’s devices and found he had been searching for spy cameras on the internet.
“The defendant purchased two spy cameras and an SD card in May 2018 from Amazon,” said Mr Newcombe.
The cameras came with “night vision”.
Police discovered the spy footage and also recovered a laptop and hard drive from Ball’s room containing a stash of indecent images of children which had been downloaded using “peer-to-peer” file-sharing software.
“The images (mainly) involved boys as young as 10 being sexually abused,” said Mr Newcombe.
There were 168 such images ranging in seriousness from Category A – the worst kind of such material – to Category C, including both photos and videos.
Ball ultimately admitted three counts of making indecent images of children and downloading prohibited images but initially denied taking covert video footage of the boy, installing the camera and voyeurism at the school.
He only changed his pleas to guilty about a month before a trial was due to take place. The offences occurred in the summer of 2018.
Ball, of Atherstone, Warwickshire, appeared for sentence on Wednesday, his teaching career already in ruins.
His solicitor advocate Richard Reed said Ball was “profoundly sorry” for his behaviour.
He said that Ball, a former care-home worker, recognised his behaviour had had a “profound” effect on the boy and other staff members and was now receiving counselling and psychiatric treatment.
“He has lost any prospect of working in a career of teaching or working in any form with children, and remains unemployed and receiving psychiatric medication,” said Mr Reed.
Judge Simon Hickey told Ball his offences against the “vulnerable” boy were a “gross breach of trust”, adding: “Parents expect their children to be looked after and not spied upon and filmed.”
Citing Ball’s “29 separate searches” for images of the boy on social media, the judge said the voyeurism offences involved “significant planning and determination”.
He said although Ball was previously of “exemplary” character, had shown “clear remorse” and character references “show there is another side to you”, it could only be an immediate jail sentence for such serious offences.
Ball was jailed for 20 months, of which he will serve half behind bars before being released on licence. He was also placed on the sex-offenders’ register for 10 years and made subject to a sexual-harm prevention order to curb his internet activities and limit his contact with children.
North Yorkshire Police Detective Constable Adam Fenwick said: ‘Thomas Ball was in a trusted position of responsibility which he has blatantly abused for his own gratification.
"When the device was found he attempted to deny all offences but thanks to extensive digital evidence we were able to prove without doubt that he had purchased and planted the camera.
“He is a cold and calculating individual who carefully planned and premeditated his actions. He clearly poses a risk to young people and we hope his sentencing will give some closure to the victim and their family.”
A spokesperson from Queen Ethelburga’s Collegiate said: “In accordance with our robust safeguarding policies and procedures, Mr Ball was reported to the Police and immediately suspended; his employment was terminated shortly thereafter. The Collegiate has supported the police throughout their investigation.”