This is possible, but likely requires at least a Bard and a Fighter
Note: this is an incredibly meta-gaming heavy answer and would likely not be an enjoyable experience if done to a player character due to that. I took this approach because the entire idea of a villain understanding "exhaustion levels" is meta-gaming.
What is needed:
An understanding of the exhaustion levels:
1: Disadvantage on ability checks
2: Speed halved
3: Disadvantage on attacks rolls and saving throws
4: Hit point maximum halved
5: Speed reduced to 0
A way to prevent the prisoner from dying
One way you could do this is through the death ward spell whose description states:
You touch a creature and grant it a measure of protection from death.
The first time the target would drop to 0 hit points as a result of taking damage, the target instead drops to 1 hit point, and the spell ends...
This allows you to damage the prisoner (required later) and guarantee that it will not kill them, this also allows you to reduce the prisoner to 1 hit point.
Knowing which exhaustion level a prisoner is at
If a prisoner were at exhaustion level 6:
This would likely be obvious, but if not you could use the speak with dead spell to determine this as it only targets corpses.
If a prisoner were at exhaustion level 5:
You could use the dissonant whispers spell, whose description states:
On a failed save, it takes 3d6 psychic damage and must immediately use its reaction , if available, to move as far as its speed allows away from you...
You could use this spell until it damaged your prisoner (likely a visible effect), and if they did not move then you would know they are at exhaustion level 5.
It is possible that they would have already used their reaction on something else and this is why the slow spell is needed as its description states:
An affected target's speed is halved, it takes a −2 penalty to AC and Dexterity saving throws, and it can't use reactions...
You could prevent the creature from using reactions through this spell, and could drop concentration on it just before dissonant whispers is cast, thus guaranteeing that if they fail the save they will try to move.
Additionally, perhaps the prisoner taking damage is not particularly visible, if they took damage you could use the identify spell whose description states:
If you instead touch a creature throughout the casting, you learn what spells, if any, are currently affecting it...
This allows you to know whether a creature is suffering from slow or benefiting from death ward (after taking damage they would no longer be under the affects of death ward).
If a prisoner were at exhaustion level 4:
This becomes more difficult to figure out...
A Battle Master Fighter has the Know Your Enemy feature which states:
If you spend at least 1 minute observing or interacting with another creature outside combat, you can learn certain information about its capabilities compared to your own. The DM tells you if the creature is your equal, superior, or inferior in regard to two of the following characteristics of your choice:
Current hit points...
You could restore a creature to its hit point maximum using healing spells such as cure wounds but if that is not an option because the prisoner is an undead or construct you could instead use potions of healing which have no such restriction.
Through healing and the death ward spell you can also manipulate your Fighter's current hit points. This allows you to determine roughly the prisoner's maximum, and thus you could also determine if their hit point maximum had been halved.
If a prisoner were at exhaustion level 1 or 0:
You could roughly determine their speed using the dissonant whispers spell. This allows you to know whether they are at exhaustion level 2 because they would only move half of the distance they did at levels 1 and 0.
If a prisoner were at exhaustion level 3:
Its speed would be halved but its hit point maximum would not, as explained above, you could determine both of these things.
You can force a creature to go to exhaustion level 0 by using the greater restoration repeatedly; its description states:
You imbue a creature you touch with positive energy to undo a debilitating effect. You can reduce the target's exhaustion level by one...
I could not think of any real way to determine if a creature is at specifically exhaustion level 1, but you could force them to go to it by using greater restoration when they are at level 2.
Thus you can determine which level of exhaustion any given prisoner is at (though significant setup and bookkeeping is required) except level 1 which you could force them to be at if you so desired.
A notable exception:
Deafened creatures are not affected by dissonant whispers so some of this strategy would not work against them. The spell's description states:
A deafened creature automatically succeeds on the save...
One possible way to avoid this problem is by using the fear spell instead of dissonant whispers. It's description states:
While Frightened by this spell, a creature must take the Dash action and move away from you by the safest available route on each of its turns
This would work as an alternative but if a prisoner were immune to frighten it would not. There is also the case that a creature could pretend to fail a save against the spell and run away from you regardless in which case you would need somebody else to use the identify spell.