Not remotely luck. Just math. The monk is a sure bet. It isn't close.
Let's put them toe to toe. Dragon: AC 22, HP 546, 4 attacks doing 28 damage each (assuming an extra attack for its legendary action. Monk: AC 27 (unarmored defence + bracers and ring), HP 183, 5 attacks doing 18 damage each (1d12+1d6+8).
Assume Monk attacks first because higher initiative bonus and much higher speed (though you can assume the opposite if you want; then the monk takes a bit more damage on the first round but still wins easily). Monk is taking half damage from all attacks that hit due to superior defence (they don't really need to use it, but why not?).
The dragon is poisoned for the entire encounter, because hand of harm (unless you're immune to the poisoned condition, you're poisoned. There is no save). So the dragon only has a 30.25% chance to hit with any attack (.55x.55), or 1.21 hits per round. Monk can deflect one attack for up to 32.5 damage each round, and may as well spend a focus point to hit back for 11 damage (20x.55, given the dragon's +9 dex save). Also, the dragon only has a 0.25% chance of a critical on any attack, so critical hits from it are not really worth considering. So in melee, the ancient gold dragon only manages to damage the monk once every 5 rounds on average, for 14 HP. Or an average of 3 damage per round (these are averages; in actuality it's a bit swingier than this but the monk is really in zero danger).
The monk is pretty much immune to the dragon's breath weapon, between having a +14 to dex saves, a re-roll if needed because disciplined survivor, and evasion. WORST case scenario is the monk takes 15 damage which...whatever - one hand of healing more than fixes it. Note that the monk is proficient in ALL saves, with a re-roll if needed, so spells in general are not a great option for the dragon.
Long story short, the dragon can barely damage the monk. In fact, if they want to spend a bit longer on the encounter, the monk can finish at full health by tossing a hand of healing on themselves as desired, but they don't need to bother. They're in no danger unless they run out of focus points.
How much damage is the monk doing? Note that all I've assumed the monk has for an upgrade is the eldritch claw tattoo (+1 hit/damage, and once per day can activate to add a d6 extra damage to attacks with up 15' range, which the monk is using). My monk got this at level 7; it's an uncommon magic item. Realistically, a level 20 monk will also have +2 or +3 wraps, but, eh, doesn't need 'em. I've intentionally given the monk minimal upgrades. So the monk is +14 to hit (+6 proficiency+7 dex+1 tattoo), with 5 attacks from the attack action + flurry of blows (one of which will be hand of harm). We would expect a .65 hit rate, but we'll reduce it to .6 for ease. Epic boon is combat prowess, so that turns one miss into a hit. Long story short: monk hits an average of 4 times/round for 72 HP, rounded up to 75 to account for the occasional critical hit.
So between that offence + a bit of damage from defect attacks, the monk should kill the dragon in seven rounds pretty easily, while taking almost no damage.
The dragon's best bet is to fly away. It needs to fly up, because the monk is actually faster than it. If I'm the dragon, I cast banishment until I get lucky and use the opportunity to escape.
Hand of harm makes a level 20 Mercy Monk absolutely lethal to anything that isn't immune to poison, and all monks have ridiculous survivability at that level.