Apart from the approaches defined by the other answers, consider making a spell, or magical item, that can be used to see alignment or determine alignment.
The general guidance, page 283 of the Dungeon Masters Guide, wants a gentle approach, with caution against creating something to powerful. Considering the flavor, the spell would be of the Divination School, and available to Clerics and Wizards at the basic thematic level.
The first consideration is how you want this feature to be used in the campaign. The weaker you make it, the lower the level of the spell can be. You could reach back into previous editions for the effect you want, such as Detect Alignment.
Detect Alignment 3.5
Divination, level 1, (V,S,M)
Duration: Concentration, 10 minutes
Range: 60 ft Cone
When you cast this spell, choose chaos, evil, good, law or neutrality. While this spell lasts, you gain the ability to detect the chosen alignment. This functions identically to detect evil, except for the chosen alignment, and using CR rather than HD for monsters.
Note, it only provides coverage of a third-ish of the available result. Choosing Chaos, Lawful, Good, or Evil leaves out the other two for that axis, while selecting Neutral covers 5 of 9 possibilities.
That is relatively fair for a first level spell, but the Question wants a more precise identification of the alignment. To meet that requirement, the area of effect can be narrowed, the level raised, or balance of the two. Looking at Detect Thoughts, a level 2 Divination spell, even in the earlier stages you only get the barest hint of the character. To get deeper, and know more about the character, takes an action and getting past a Wisdom Saving Throw. Probing further, you start competing in Intelligence contests. For all of this, the caster has a span of a minute; just 10 rounds.
A comparative Detect Alignment spell, could be mechanically built the same way at this level. However, instead of turning to an Intelligence v Intelligence contest, working to learn more about what their thinking, it would use a Charisma v Wisdom contest. Their ability, or mental confidence, to out bluff your ability to perceive what their alignment is.
This is only an example. The spell level could be increased to support lessening their ability to resist.
If a spell doesn’t meet the thematic approach that you’re looking for, making a magic item (DMG, 284) is also an option. A few examples follow, but don’t let yourself be limited to these.
Styled after Keoghtom’s Ointment, consider a similar substance that will react with the targets alignment when exposed to their skin. Starts as a plan white with a granular texture, and then: Glows for Good, seems to Absorb light for Evil, becomes rough and jagged for Chaotic, and Flat for Lawful. Given the precision of the substance, it should be at least a rare item, and have a limited number of doses available. Thematically, beyond a specific mcguffin, it’s construction should be beyond the reach of the player characters; rather, it’s provided or available in support of their quest.
If your something with a bit more permanence, observe the effects if a misaligned character handles Book of Exalted Deeds. There is a visceral, damaging reaction; too extreme for your aim, but a fair guide post.
Tyr’s Scales Wonderous Item, Rare
A metal statue of a warhammer rising from the dirt, with a scale resting upon the head. Each side of the scale features a bas relief; one an ordered image of Tyr, the other a corrupt version of the same. When a supplicant grasps the haft of the warhammer, the scales will shift as the nature of the soul weighs down one side in accordance with their alignment.