Waldemar de Carvalho, a federal judge in the capital Brasilia, backed a psychologist who had her licence revoked for offering so-called "conversion therapy".
Rozangela Justino is an evangelical Christian who has called homosexuality "a disease".
Critics have called the ruling regressive and medically unsound.
Brazil's Federal Council of Psychology banned psychologists from offering treatments that claim to change people's sexuality in 1999.
It said in a statement that the decision "opens the dangerous possibility of the use of sexual reversion therapies" and promised to fight it in court.
Prominent pop star Anitta shared her disgust in an online video, which has been watched by over a million people.
"That's what happens in my country. People dying, hungry, the government killing the country with corruption, no education, no hospitals, no opportunities... and the authorities are wasting their time to announce that homosexuality is a sickness," she said.