The court ruling came on a petition filed by non-governmental organisation ‘Paryas Bharti’.
Ms Ruby is lodged in Beur central jail here for the last 10 days.
Opposition leaders and several social and human rights activists had pointed out that Ms Ruby, the Class 12 arts stream ‘topper’, was jailed in violation of the Juvenile Justice Act.
She was arrested by the Special Investigation Team (SIT) of Bihar Police, probing the scam, after she failed in a re-test. She was later remanded to 14 days in judicial custody.
The SIT has lodged an FIR against her and three other ‘toppers’, including science topper Saurabh Shreshtha.
According to police officials, a Patna civil court has issued a non-bailable arrest warrant against four ‘toppers’, including Ruby Rai.
Nearly 20 people have so far been arrested in connection with the scam.