The petition filed by lawyer Maulvi Iqbal Haider was accepted by the Islamabad high court yesterday.
Haider asked the court to restrain the President and Prime Minister from taking any action against the army and ISI chiefs by issuing a notification until a final decision is made on his petition.
However, Haider is considered a "dubious character" by the Supreme Court and has been barred from entering the apex court's premises by Chief Justice Iftikhar Chaudhry for filing frivolous petitions, The Express Tribune reported.
Haider filed the petition hours after the military warned that Prime Minister Yousuf Raza Gilani's criticism of the army and ISI chiefs could have "grievous consequences".
Gilani sacked the Defence Secretary yesterday and there has been speculation that the government may take similar action against the army and ISI chiefs.
He filed his petition under Article 199 of the Constitution and named 11 respondents, including the President, Prime Minister, army chief, ISI chief and chairman of the National Accountability Bureau.
Haider asked the court to declare that the President and Prime Minster had failed to perform their constitutional duties by disobeying the orders of the Supreme Court and the judicial commission probing the Memogate scandal.