I don’t think that played much of a role. It’s my understanding that those studies didn’t come out until after ivermectin had already become established as a “real” treatment. Here’s my (layman’s) understanding:
Early in the pandemic, a lot of medical researchers were looking at a lot of different treatments for COVID-19. Previous laboratory work had indicated that ivermectin had some significant anti-viral activity in vitro. A number of researchers decided to take a look at it, and some of them published a number of quick, small, low-quality studies which seemed to indicate ivermectin might be useful as a treatment for COVID-19. Subsequent studies, which were larger and of higher quality, showed no significant anti-viral activity in vivo. (As @Pardel-Lux points out, some still later studies showed significant protective effects against COVID-19 when ivermectin is used to treat the kinds of parasitic infections it’s supposed to be used for, since those infections can weaken the immune system and make sufferers more vulnerable to other infections, like COVID-19.)
A lot of substances show some anti-viral activity in vitro but don’t pan out in vivo. And, like a lot of those substances, the concentrations of ivermectin used in the in vitro tests would be highly toxic if used in vivo.
But, by the time those disconfirming studies came out, it was too late. The meme of ivermectin as a wonder drug had already infected the trust networks of a lot of people. For a lot of people, the CDC, WHO, FDA, and similar organizations are outside of their trust networks. A lot of people are conditioned to believe the opposite of what organizations like that contend.
Ivermectin is fairly widely available as a prescription medication (for treating parasites), and quite widely available in veterinary formulations as an over-the-counter medication. For scared, desperate people, the lure of a relatively cheap and widely available treatment for a frightening disease, especially for people whose trust networks are already overwhelmed by opposition to effective infection control measures (anti-mask, anti-vax, anti-social distancing), is going to be very seductive.