The bail hearing for the 16-year-old, who cannot be named for legal reasons, was heard today at the appeals court in Edinburgh.
The boy has been held on remand since his first court appearance at Aberdeen Sheriff Court on October 30 - two days after Bailey died from a chest injury sustained at the city’s Cults Academy.
The teenager’s solicitor Peter Shepherd hoped to convince the appeals court that his client should be freed until the case resolves or goes to trial due to his young age.
However the Crown Office today confirmed that the bail appeal had been rejected.
Bailey, a fifth-year pupil, was seriously injured at the school during his lunch break on October 28.
Earlier this week it emerged that his death was caused by a penetrating sharp force injury to his chest.
His death certificate also revealed that he died at 3:20pm shortly after he was taken to Aberdeen Royal Infirmary by ambulance.
The 16-year-old, who is alleged to have murdered him, has also been charged with possession of a offensive weapon at a school.
Hundreds of pupils paid tribute to Bailey laying flowers at the gated entrance of the school in the wake of the tragedy.
Crowds of students lined up at the front of the building to pay their respects as police carried out investigations inside the school.
His relatives released a statement thanking students and members of the public for all their support following their visit.
They said: “Thank you for all your help. Your kind words and the lovely things you have left for Bailey.
“It means a lot and it would have meant a lot to Bailey.
“For all of you that were part of his life, however big or small, thank you for being there.”
Bailey lived with his mother Kate Gwynne, 33, her partner John Henderson and his four younger brothers in the village of Maryculter in Aberdeenshire.
His funeral is to be held in private.