Fluoride in drinking water has no effect on IQ or brain function, long-term study shows
(twin-cities.umn.edu)
Decreasing number of cavities in children != increasing IQ
IQ only measures the ability to solve problems and pattern-match. And I would assume IQ tests are taken after cavities are dealt with.
To give an example, it's the same thing as if you tried to give an IQ test to someone who, in the past, has had a bacterial infection. Then, when the person is perfectly healthy, you give them an IQ test once, then some antibiotics, then another IQ test giving the same result as the first. You would not conclude that antibiotics are ineffective and should be banned!