Parasites can cause hormonal changes and seriously affect behavior so I think it is possible.
“Abstract
In a controlled study 67.5% of 200 homosexual men but only 16% of 100 heterosexual men were found to be infected with intestinal parasites. Entamoeba histolytica was isolated from 27% of the homosexual and 1% of the heterosexual men, and Giardia lamblia was isolated from 13% of the homosexual and 3% of the heterosexual men. The presence of symptoms could not be correlated with infection except when the infection was caused by more than one organism, including G. lamblia. Symptoms were much more common in both infected and uninfected homosexuals than in heterosexuals.”
https://pubmed.ncbi.nlm.nih.gov/7437971/
“New theory: Homosexuality in Men is caused by parasites and viruses”
https://lookism.net/threads/new-theory-homosexuality-in-men-is-caused-by-parasites-and-viruses.752487/
“Unusual theory: They are scared of Ivermectin because it is a cure for homosexuality”
https://www.reddit.com/r/conspiracy/comments/pxmvsm/unusual_theory_they_are_scared_of_ivermectin/