WASHINGTON — Stephen Moore, President Trump’s preferred choice for the Federal Reserve, has written that women should not serve in the military or serve beer at men’s basketball games — unless they look like his favorite female ESPN commentator and dress in halter tops. He has scraped through a messy divorce, failing to pay hundreds of thousands of dollars in alimony and child support to his ex-wife.

Confronted by his history, Mr. Moore has been defiant, saying he views the attacks on his character as a “badge of honor.”

If Mr. Moore sounds a lot like Mr. Trump, that may be no coincidence. Gleefully indiscreet, politically incorrect and unrepentant about his views of women, Mr. Moore is not just similar to the president, but also the latest in a long line of male malefactors for whom Mr. Trump displays a strange affinity.

Mr. Trump, who has his own troubled history with women and has bragged about sexual misconduct, has displayed an almost across-the-board disdain for accusations of harassment, assault or just plain sexism lodged against men who also proclaim their innocence, as he does.