The Delhi High court ruled that Kalmadi could not attend the opening ceremony but didn't ban him from attending other events on the proviso that he is not seen to be representing India.
"From the national point of view, we have decided the matter and he should not participate in the opening ceremony of the Olympics," the court ruled. "His participation can cause embarrassment to the country. National interest is the prime concern."
Kalmadi had earlier told the court he was not representing the Indian Olympic Association at the Olympics but had received an invitation from the International Association of Athletics Federations because he is president of the Asian Athletics Association.
Kalmadi is on bail after spending nine months in jail awaiting trial on corruption charges related to the 2010 Commonwealth Games. He has not been convicted on any charges and remains head of the IOA.
The court, which took up the matter after a case was filed by lawyer-activist Rahul Mehra, also ruled that Kalmadi should not leave the country before Friday.
Kalmadi had earlier received permission from a lower court to travel to London from Thursday, in time to attend the opening ceremony. The 2010 Commonwealth Games were marred by construction delays and a budget which ballooned to $15 billion from an initial estimate of $412 million.