"The damage that will be posed by temporarily restraining a lawful cabinet of ministers from functioning would be ... outweighed by the damage that would be caused by allowing a set of persons who are not entitled in law to function as the prime minister or the cabinet of ministers", judge Preethipadhman Surasena said.
The South Asian nation has been in crisis since President Maithripala Sirisena replaced Prime Minister Ranil Wickremesinghe with Mr Rajapaksa in October, then issued an order dissolving parliament and called for a general election.
The decision casts further legal doubt over Rajapakse's claim to lead Sri Lanka, which has been in turmoil since his controversial appointment a month ago.
Sirisena held onto a hard-line stance even as the Court of Appeal issued an interim order blocking Rajapakse exercising the powers of the prime minister until a determination of the case filed by 122 MPs.
The interim ruling was a major blow to both President Sirisena and Rajapaksa after the former had appointed the latter as the prime minister on October 26, plunging the country into constitutional crisis.More news: Verizon, Samsung promise 5G smartphone for next year
More news: Trump requests Pakistan's help on Afghan peace after Twitter tirade
More news: Kremlin says it expects Putin-Trump meeting to go ahead
A majority of legislators asked the Court of Appeal last week to intervene, saying Rajapakse should not have remained in office after parliament passed motions against him.
Rajapakse urged his supporters on Monday night to remain calm and join his struggle to press for a general election almost two years ahead of schedule.
As of now, Ranil Wickremesinghe, who enjoys majority support in Parliament is the obvious choice for the Premiership.
Minority Tamil legislators who held talks with Sirisena on Monday evening said the leader had told them he would resolve the political vacuum "within 24 hours".
In fact, President Sirisena had said a couple of times that he will never appoint Wickremesinghe. However, there were no signs of a settlement by Tuesday afternoon. The Supreme Court overturned Sirisena's decision to dissolve Parliament and halted the preparations for snap polls.