Accusing opposition groups of trying to foment violence to derail economic reforms, President John Magufuli's government wants to amend the law governing political parties.
Critics say that would sharply curb freedoms in the East African nation and prevent an effective challenge to Magufuli and the ruling Chama Cha Mapinduzi (CCM) party in next year's general election and this year's local elections.
Tanzania, a nation of 57 million people, has long been regarded as one of Africa's most stable democracies. The ruling CCM party, and its predecessor TANU, have governed since independence from Britain in 1961.
However, since Magufuli was elected in 2015, his administration has implemented draconian curbs including banning some newspapers, restricting opposition rallies, and detaining dozens of their members. The 59-year-old has been nicknamed "The Bulldozer", partly for his pugnacious management style.
That has drawn criticism from Western donors who provide hundreds of millions of dollars annually.
Some have suspended loans or aid.
Under the proposed legal changes, individuals conducting civic education - for example giving out information on voter registration - must seek permission from a government-appointed registrar of political parties or face a fine and up to a year in jail. Opposition leaders say the registrar would also have sweeping powers to de-register parties.
Parties would also be forbidden from functioning as "pressure or activist groups".
But the court rejected the opposition's plea on a technicality. "This petition was not properly filed. It is therefore struck out with costs," said judge Benhajj Masoud.
The opposition leaders said if debate proceeds later this month, the amendments are likely to be rubber-stamped by a parliament dominated by the ruling party.
Lawmaker Zitto Kabwe, one of three opposition leaders who filed the lawsuit, said on Twitter he would keep fighting.
"If the bill is eventually passed into law, we will oppose it again at the courts of law," he said.
If the amendments pass, Tanzania would become "a de facto one-party state", said Kabwe's ACT-Wazalendo party.
The amendments were filed in November and expected to come up for debate after lawmakers return from recess on Jan. 29. (Reporting by Fumbuka Ng'wanakilala Writing by Katharine Houreld; Editing by Andrew Cawthorne)
(This story has not been edited by Devdiscourse staff and is auto-generated from a syndicated feed.)