Short answer: It depends on the gay man. Also, I'm assuming we're talking about cis (non-transgender) gay men in this instance.
Long answer: It depends on the gay cis man because just knowing there is a vagina present on someone's body is enough to turn off some cis men who are exclusively attracted to men. Some transgender men have had some type of genital surgery and no longer have functional vaginas, but that doesn't guarantee a gay cis man will decide to sleep with them.
Whether a gay man will sleep with a transgender man depends on his personal comfort zone when it comes to his choice of sex partners. Without a doubt, it's possible to have anal sex with someone without dealing with or touching that person's genitals. It's also possible to have anal sex with someone without seeing their vagina or penis. That's something two people can get around if the person penetrating the trans person doesn't want to deal with a vagina or penis.
The vagina or penis on the person being penetrated can even be covered up to make it extra unlikely that the genitals are seen if both parties are okay with that.
However, those facts will generally not make much difference for someone who is turned off by the idea of a vagina being present. Or, for that matter, someone who likes using penises for something too much to go without one on a partner. Or someone who needs the visual of a penis being there in front of a person.
A male who prefers to penetrate and prioritizes tightness and adventurousness over the presence of a penis may enjoy something about a trans man who "bottoms" and is into anal sex. There is something only someone with a vagina can do to make anal sex feel even tighter or more interesting. I will leave it at that because this post is not on that topic.
As a gay trans man, I respect that some men have an aversion to vaginas - even if those vaginas are not being used for anything. I've encountered multiple men who seem to see a vagina on a man as a "deal breaker" and I understand it's nothing personal.