As others have brought up, the question about whether it was a good move from the DM, and whether it was an evil act for a paladin are two separate issues. I'll add that both depend on having more information than we have.
Some assumptions that people seem to be making are (to elaborate on and add to my previous ones):
1) It was obvious to the player that if the paladin didn't give up the NPC their character would die. Sub assumptions to this might include:
1a) The paladin was alone and overwhelmingly outmatched.
1b) The paladin was in a blind alley situation with literally no way within the game rules to escape the dragon.
1c) Dragons in this game are not known to negotiate. It is worth noting that D&D editions (including 5e) actually often say that certain varieties of evil dragons
will negotiate and be willing to leave you alone in exchange for treasure or such, though the player may not be familiar with that.
1d) The paladin didn't have any tricks up their sleeve to allow them to sacrifice themselves and save the NPC.
As far as 1a)...
I don't know what game you play, but a party of 7th level PCs wouldn't stand a chance against an adult red dragon unless they were extremely lucky and had prep time in my campaign. One failed dex save vs breath weapon would be the death of most PCs.
We weren't told it was a red dragon. So let's assume the evil dragon right in the middle of the power curve: the green dragon. Even a level 7 wizard/sorcerer/warlock with Con 12 would be unlikely to die to a single failed save against the dragon's breath weapon (though they would be very likely to drop to zero). A level 7 fighter/paladin/ranger with Con 14 has a slightly better than average change to still be standing after a failed save. It is unlikely that anyone will die in the first round, and ever after the dragon's spot in initiative, it is likely that there will still be people up. Most characters will likely get a chance to act in the first round. A party of, say 5 full-strength well-built and well-played PCs could totally defeat that dragon in a stand up battle (which the dragon would likely be smarter than to actually get into, which is a separate point in favor of this not necessarily being a no-win scenario). It's also a reasonable assumption that someone in a typical level 7 party has access to
revivify and up to 4 potential spell slots in it, so it's quite likely that all of the PCs would walk away from this battleground alive.
Now, is this what would happen with a typical group of 5e players? Probably not. But with a little time I could build a party of five 7th level characters (who are optimized for general adventuring--not optimized against green dragons in particular) who would have say a 70% or better chance of taking out the dragon with no dead party members afterwards, and something closer to a 95% chance of at least driving the dragon away (or escaping it) without a TPK. And I'm not even an expert optimizer. There are almost certainly others on these forums who could build a four character party that could do it, and build it faster than I could. People claim 5e is easy mode for a reason. Again, this isn't what would happen with probably most groups, and we don't know if the party is at full resources, etc. My point here is just that, with the information we have been given, defeating (or at least driving it off and having at some members of the party survive to drag your corpses back to a 9th-level cleric for
raise dead) the dragon in a fight is not off the table as a reasonable possibility.
2) A major assumption that is often forgotten in these scenarios is an assumption that you can trust the bad guy not to do the bad thing anyway, after he gets you to do your bad thing first. If you're wrong, now everyone did something that led to a bad consequence, and no good consequences came from it, because you assumed the bad guy would keep his word. Did the paladin have a reason to believe that if he turned over the NPC the dragon would in fact leave him alone, rather than fly off for a nice meal and then come back and pick off the paladin rather than having to fight both the NPC and the paladin at the same time? (One point of argument in favor of deontological morality versus consequential is the uncertainty of accurately predicting the consequences of an action in any particular situation.)
On the issue of DMing, we have different assumptions that have been made, which mostly center around an assumed lack of communication.
A) The DM viewed and presented this as a sacrifice yourself in vain for your ideals or sacrifice your ideals and live to fight another day scenario, instead of a scenario where the player, based on the campaign up to that point, would have reasonably expected that a choice to stand up to the dragon would lead to some sort of loss that was lesser than a TPK or permanent character death.
B) The player was unaware and/or not on board with the likelihood of his paladin being presented with difficult choices that might have major consequences for his character.
C) The player didn't view the choice as evil and/or a violation of his oath.
Again, my point is that we haven't been given enough information. In the interest of demonstrating how things could be different without some of those assumptions, the scenario might in fact have been something like the following.
Possibility: The player and DM were on the same page with an established campaign understanding that there were serious (possibly mechanical) consequences for violating a paladin's oath/alignment, and that difficult choices where you might have to suffer some sort of loss in order to maintain your oath/alignment were likely. It was understood in this campaign that the DM wouldn't take your character away from you (ie, permadeath) without your out of character consent. The player reasonably saw the choice as one of taking a personal loss (giving up that
flametongue sword and all your gems, for instance, or dying fighting while the NPC escaped using a magic item, with the assumption that they would later be resurrected by the party with, but without their gear) to save a life, rather than one of retiring his character or getting hosed. The player, then decided that his paladin was going to perform an action he thought was evil and/or a violation of his oath, knowing and accepting that there would be some sort of serious consequences, rather than lose his gear (or whatever). The DM is now trying to decide what would be a fair consequence that would contribute to a more enjoyable campaign for all.
Is that what happened? I don't know. But it's a possibility from the OP.