This is likely between Medium and Hard difficulty encounter for the party
You can find general guidance on encounter difficulty in the Dungeon Master's Guide (DMG) in the Creating Encounters Section. For level 5 characters, the XP table shows:
Level ------- Easy --- Medium --- Hard --- Deadly
5th ---------- 250 ---- 500 -------- 750 ----- 1,100
This means that 5 level five characters would treat a Young Black Dragon (XP = 2,900) as a Medium encounter (5 * 500 = 2,500). While there are some monsters that break this mold and difficulty can be increased depending on the composition of enemies, this is a good rough metric.
Consider the level of optimization in your party
If your characters are particularly good at dealing lots of damage or protecting a single character, boss battles like this will be easier than usual and you should increase the difficulty by about 100 XP per level so 500 XP (this is a number I've used in the past and has worked wonders for me).
If you have new players and/or players who are not tactically minded or are unfamiliar with the mechanics, you should decrease the difficulty to the next lowest setting (an Easy encounter will be Medium, a Medium encounter will be Hard, etc.)
How hard do you want it to be?
satisfying battle in the sense that they coming close to defeat and beating the odds.
This sounds like you want it to be somewhere between Hard and Deadly, which a dragon on its own won't accomplish (unless your party fits the "new player" category I described earlier).
To fix this, you will need your XP approximation to equal 4000-5000. Adding just one Black Dragon Wyrmling pushes the number to the top end of this value at 5,025 due to the Modify Total XP for Multiple Monsters section in the DMG (2 monsters means a 1.5x multiplier).
For a lesser difficulty, but still a suitable challenge, try adding a CR 1 monster like a Goblin Boss or just add a couple of terrain effects to increase the difficulty indirectly.
For a higher difficulty, pushing into the Deadly range, you will need a CR 3 monster like a Bugbear Chief, or add terrain effects or traps to the Dragon and Wyrmling encounter.