I was once taught a valuable lesson regarding this. I got a job at a pub when I was at college. I was somewhat naive.
Anyway, turned out the pub had gay nights. Well I definitely was not prejudiced, just ignorant. One evening early a guy walked in on a non-gay night. No one else in and we got chatting. He seemed a nice guy. After a while he asked why the pub was so quiet. I said that I thought possible that a lot of locals were put off by the reputation of the pub as a gay haunt (I did not say this in agreement with that view, just as a possible factor).
He said he had just moved nearby and produced a copy of I think a Gay Times listing that named the pub as gay friendly.
I apologised in case he thought I was being in any way rude by my comments about local anti-gay sentiment.
Anyway, we got chatting some more generally, and was fine. At one point he said to me that one thing he got a lot when men knew he was gay was them worrying he was going to try to bum them. As he so wisely said, of course. most of them need not have worried as he didn't fancy them anyway, and the others he did not tend to drug and rape against their will as a rule.
I did tell him at some point I was straight, but not in a defensive context. By this stage I think it was just a mention of my gf at the time, so not even direct.
Finally, can safely say that have had a fair number of gay friends and colleagues down the years. Even employed one to the slightly raised eyebrows of others in the company at the time, and no, I didn't do as rebellious act. Just cos the guy was good for the job. With some I have happily compared tales of sexual adventures, and with others that has never been a topic of conversation. Don't tell everyone, but it's a secret I have discovered. Not all gay guys are alike! Some are lovely and some are 'orrid, just like us straightie pies!