A judge has banned a planned jubilee celebration of the 1
President Jair Bolsonaro had planned to celebrate Sunday the anniversary of the beginning of military rule.
The decision of the far-right president had triggered a widespread condemnation.
He defended the decision earlier this week, stating that the goal was to remember the era rather than remember military rule itself.
Judge Ivani Silva da Luz said the event marking the 55th anniversary of the coup was "incompatible with the process of democratic reconstruction".
He said that festival days must be approved by the country's Congress.
21 years of dictatorship in the 1960s and 70s, at least 434 people were killed or disappeared.
None of the former rulers was prosecuted.
Mr. Bolsonaro, a former army captain who openly admired former dictators, was elected in October.
He is a divisive figure who has provoked controversy with racist, homophobic and misogynistic commentary.
The opposition to the planned celebrations had grown throughout the week. Social media calls for protests in Sao Paulo and Rio de Janeiro.
On Tuesday, the Brazilian Public Prosecutor's Office issued a statement that celebrating the dictatorship is "an unconstitutional regime responsible for serious crimes of human rights abuses."
"This initiative sounds like an excuse for the practice of mass atrocities and therefore deserves social and political rejection," the statement went on.