A bench of Justices N V Ramana and P C Pant observed that it was "not advisable" to release Rai on bail at this stage.
"We are of the opinion that it would not be advisable to release the accused (Rai) on bail at this stage," it said while allowing the appeal filed by Bihar government against the high court's order.
On March 6, the apex court had issued notice to the accused on Bihar government's plea and said that Rai shall not be released on bail.
The high court, in its February 14 order, had asked the lower court where the case was being adjudicated to frame charges within a month and grant bail to Rai.
Rai, one of the alleged masterminds of the scam, was arrested on June 11, 2016.
He was running a college in Vaishali and it was alleged that undeserving students appearing at intermediate exams from there were made state toppers in connivance with Bihar School Examination Board 's then chairman Lalkeshwar Prasad Singh and others.
Lalkeshwar's wife and former JD(U) MLA Usha Sinha is also one of the prime accused in the scam.
The special investigation team, constituted to probe the scam, had chargesheeted against 32 accused, including Rai.