The 28-year-old finished in five minutes 38.19 seconds, ahead of Ethiopia's Hawi Feysa and Adanech Anbesa at the Meeting de Montreuil in Paris.
The double Olympic 800m champion told the IAAF to focus on catching dopers after her first race following an appeal against the governing body.
Semenya fails to make Olympic qualifying mark in 5,000m
Following her victory, she said: “I’m not an idiot. Why will I take drugs? I’m a pure athlete. I don’t cheat. They should focus on doping, not us. I’m never going to take drugs.
I always run every day. For me it is my daily bread. I really don’t have time for nonsense, for messages for anyone, I made it clear a long time ago that I am going to focus on myself and not anyone.
“They [the IAAF] have a problem with me, I don’t have a problem with them. That is their business to worry, not mine. I came here to deliver and I have delivered.
“I am not going to talk about the appeal. I am not the lawyer, all I can answer with is my performance. What I do best is perform and my actions will speak louder than words. I am just going to keep doing what I do best. People will provoke you but for me negativity does not exist.”
Semenya has appealed against the court of arbitration for sport ruling which approved plans for a new testosterone limit.
It is for female athletes who want to compete internationally between 400m and a mile.
Semenya can temporarily run after the ruling was suspended by the Swiss federal tribunal with the appeal pending. She is battling to defend her 800m title at the world championships in Doha later this year and has been included in South Africa’s provisional squad.
Semenya open to 5000m qualification bid for Tokyo Olympics
Semenya to take fight to European Court of Human Rights