Well to be clear, the Legendary aspect doesn't, in theory, make the monster anymore challenging.
I get what you're saying, but I would advise against a solo combat the ends a campaign that does not feature legendary resistance. A single failed save ending the climax is ... boring.
As for whether this is a decent challenge? Deadly encounter XP threshold would be 14,400 XP. This is 18,000. If they are fully rested before hand, this will likely not be a TPK, although they might lose a PC or two. I'd do the following for an end of campaign encounter where I was aiming for "they will likely win, but realistically might lose"
1.) Add a time consideration that forces them to get to and defeat the beast without an additional rest. I'd have them be forced to go in and take it on without letting them optimize spells for the encounter, etc...
2.) Add two encounters before the Dragon, making sure both are 'high hard' in XP and not fast combats (larger numbers of 40+ hp monsters, creatures that can evade attacks and spells, etc...). This builds anticipation, and makes them consider how to use resources.
3.) Make it a spellcaster. 5 6th level or lower spells. (All of my dragons are spellcasters and get to apply a free metamagic from the sorcerer class to each spell, usually quicken, which makes them horribly scary as they should be, rather than a one trick pony).