That's the problem that division into genders is supposed to address. Currently we have n = 2. Results favoring one of the two genders is addressed by having separate categories with separate results: women's records, men's records.
Rather than splitting by gender it should be split by sex, or birth sex, if you prefer.
Everyone's relative chromosome string should be determined, like XXY and that should be the category, devoid of any loaded words like "man" or "woman". If you're XY, you don't get to got against XX athletes, regardless of the identity of anyone involved.
The problem is that doesn't entirely work for trans women. Hormone therapy during their transition will reduce their performance to the point where they mostly can't be competitive with cis men anymore, while they'll still dominate against cis women.