I don't think it matters that much if Ash loses against Leon; considering Ash would still essentially be the second strongest trainer in the world at that point and is definitely going to end up as the trainer who came closest to beating Leon.
However, the issue would be how the story continues from there. It is unlike Ash's personality to just give up after the PWC. Plus, now since he's in the Master Class; he can actively challenge Leon multiple times for the title (Unless of course, he drops to rank 8 and ends up losing to the leader of the Hyper Class).
On top of that, Ash should be a world-renowned celebrity at this point. Someone who all trainers would be in awe of. I don't see how they can keep the current trajectory going by keeping Ash in Paldea and take him to greater heights.
Journey's should wrap up Ash's current journey and create a different path for him all together assuming he still takes the role as the main protagonist. To do that; it would make the most sense for him to defeat Leon.