The order comes after a watchdog, Reporters Without Borders, warned of authorities' "increasingly repressive attitude to the media", despite government talk of greater freedoms in the country.
Mahdi is charged with treason-related offences and could face a possible death sentence if convicted.
State security prosecutors "banned the publication and the media's dealing with the criminal case" of Mahdi, the official SUNA news agency said.
The decision was made to avoid negatively affecting the investigation and course of justice, it said.
More From This Section
He had reportedly accused the Rapid Support Forces (RSF), which are under the authority of NISS, of rape and other abuses of civilians in the Darfur region of western Sudan.
RSF commanders denied that their unit had raped, looted or committed arson.
After his arrest, Mahdi's party pulled out of talks with the ruling National Congress and other parties aimed at resolving the multiple crises gripping the impoverished, war-torn country.
President Omar al-Bashir appealed in January for the national political dialogue.