Writing historical fiction means silencing the voice of the snobby histfic reader (who I'm intimately familiar, being a bitchy and snobby histfic reader myself) in the back of your head going "um, there's no evidence for this" and "I'm about to nitpick the evidence for this into oblivion" and "don't. defame. the. dead" that would make you second-guess a lot of things you want to write.
Historical accuracy is rarely a simple, objective measure for a story in the first place.
Sometimes... what people claim is "historical fact" or "historically accurate"... is not historical fact or historically accurate.
Sometimes the "historically inaccurate" or "least likely" option is the version of events you want to tell - not because you think it's what really happened but because you find it the most interesting option.
Or it's the option that fits the story you want to tell best. Or it's the option that makes you happiest or the most comfortable. Whatever.
"Most likely" and "least likely" arguments about historical mysteries or lacunae are nearly always subjective.
Just because something is deemed "most likely" does not mean it actually happened. Just because something is deemed "least likely" doesn't meant it could never have happened.
Claims of historical accuracy have often been weaponised to reinforce a view of the past as primarily cis, straight, white and male.
The people who are loudly and stridently arguing that it's inaccurate (and stupid and wrong and ridiculous) to depict the Historical Figure as queer, trans, not-white etc. aren't worth listening to.
Even if they're right. If they are, there'll be other people saying it without the vitriol. And you only have to listen to the other people if being factually correct matters to you.
You'll never make the people who know enough to nitpick your choices into oblivion happy unless your story perfectly complies with their preferred version of events. Write for yourself, not for them.
Don't defame the dead generally means "your depictions of my faves are bad and you should feel bad, this is a moral outrage" and has been used to critique a whole range of characterisations and plot choices the reader doesn't like.
This includes representing a historical figure as trans, as queer, as disabled, as non-white. It is not defamatory to represent a historical figure as trans, queer, disabled, non-white, etc.
Even if you don't have the evidence to prove it.
Even if it's part of a depiction of The Historical Figure as evil. There's nothing "defamatory" about being disabled, about being queer, trans, etc.
It may mean that you, the author, are using harmful tropes that perpetuate racism, transphobia, homophobia etc. But it may not. You can write the Evil Gay Villain or you can write a villain who is also gay.
There's a difference between depicting a character who might espouse horrible viewpoints and the narrative approving of it.
For the vast majority of historical fiction? The Historical Figure and everyone who ever knew them or knew people who knew them have been dead for centuries. They are well past caring or being harmed by a novel.
It's worthwhile to think about what it means to depict The Historical Figure in whatever way you're considering but don't get caught up in "Only Positive Depictions/Only Historically Evidenced Depictions Allowed" games.
Sometimes what the story is exploring is more important than whether The Historical Figure is "defamed" or their depiction can be declared historically accurate.
Less "is the dead being defamed" and more "are the characters complex? are their actions understandable? Do the antagonists feel like they could have been a real human and not an monstrous villain? Do the protagonists feel like shining perfect angels or human beings?"
Because at the end of the day: the characters of historical fiction were human. They weren't goodies and baddies in a cartoon designed to teach children morals.
All historical fiction is, inevitably, historically inaccurate. It cannot hope to be an entirely faithful and accurate recreation of a historical moment for which only fragmentary evidence remains.
Fuck the historical accuracy police. Fuck the don't defame the dead police.