Olympic and world swimming champion Cesar Cielo has been cleared to compete in the Fina World Championships by the Court of Arbitration for Sport (Cas).
The Brazilian and three team-mates were warned, rather than banned, by their national governing body when they tested positive for banned substance furosemide at a meet in Rio in May.
Fina, swimming's world governing body, appealed against the decision.
However, Cas dismissed the appeal at a hearing in Shanghai on Thursday.
Cielo, who faced a ban of two years had Fina's appeal been successful, said he consumed the drug in a contaminated batch of a food supplement he regularly used.
Decisions on Cielo's team-mates Nicholas Santos and Henrique Barbosa were also upheld, while Cas gave Vinicius Waked, who had previously served a two-month ban for a separate doping offence, a one-year ban.
Cielo won the 50m and 100m freestyle at the World Championships in Rome in 2009.
The 24-year-old also took gold in the 50m freestyle at the 2008 Beijing Olympics.
Cielo, Santos and Barbosa are now free to take part in this year's World Championships in Shanghai with the swimming events scheduled to begin on Sunday.