125 doctors and nurses did a clinical trial as to whether taking 600 mg of Hydroxychloroquine daily could prevent infection by Covid-19.
It had no statistically significant effect.

https://medicalxpress.com/news/2020-09-hydroxychloroquine-effective-placebo-covid-.html

Sample quote

Extensive testing was used to rigorously prove who did or did not contract the virus. Each person received swab and antibody testing for COVID-19 at the start of their participation in the study, halfway through, and at the end—an eight-week span during the study period that began April 9 and ended July 14, 2020. Participants also had electrocardiogram (ECG) tests because of concerns about hydroxychloroquine causing heart rhythm problems in severe cases of COVID-19.

"To really test the potential of HCQ as a prevention drug, we felt it was key to recruit health care workers with many hours of direct physical exposure to COVID-19 patients, then randomize them in a double-blind manner between hydroxychloroquine or a matching placebo, and treat them for a long period of time," said Amaravadi. "Through that whole time, we monitored participants closely for their safety."

At the end of the study, 6.3 percent of those who took the hydroxychloroquine had tested positive for COVID-19 while 6.6 percent of those who took the placebos were positive. None required hospitalization. Additionally, there was no difference detected in the heart rhythms between those in either arm of the study, which showed that while the drug had no preventive effect, it was also not detrimental, outside of some temporary side effects like diarrhea for some.

"The differences we saw were negligible," Amaravadi said. "And those who did get the virus, whether they were taking hydroxychloroquine or not, were all asymptomatic or had very mild forms of COVID-19."

End quote