Religion can definitely be used to bring about the ideas of liberation, personal freedoms, wholesomeness, and actions that resonate perpetual respect to quash dystopias. The other aspects of religion such as conformity, suppression of identity, repression of innate desires, and actions that reverberate constant judgment can validate dystopias.
Religion is a utility that can be used by the wielder to justify any preconceptions they hold. Any religious doctrine is subject to this fate; it is up to the beholder of the scroll to not troll others into their destructive fold. I believe it’s also up to individuals to not be manipulated by another clever person into enacting irreversible plights unto unsuspecting people. Religion is not only a tool for foolery, because it has a beautiful history of shifting or questioning power imbalances that exist in the world. Martin Luther, a priest, questioned Catholic Church Priest about their tyrannical motives and brought Reformation- which gave rise to Protestantism.
Religion from my understanding is a torch that can be used to guide others out of the cave of darkness or burn the people within it. At the end, all that matters is who wields said torch.