In rare cases, effects can happen at the same time, especially at the start or end of a creature's turn. If two or more things happen at the same time on a character or monster's turn, the person at the game table - whether player or DM - who controls that creature decides the order in which those things happen.
Xanathar's Guide to Everything, page 77
So, if it's the NPC turn, your Dungeon Master decides what happens / triggers first. If it's your turn, you decide.
This is optional rule so if you are not using it at your table, then it's DM call. But I believe it to be a fair rule to follow, and using rules from the book can help to prevent disagreements.
Either way, both effects take place, if after the first one, the second one still makes sense:
So if sanctuary goes first and stops the attack, no roll for duplicate retargeting is needed. If mirror image goes first and the roll indicated the real character, then roll for the sanctuary takes place.
This is because if first effect prevented the attack, the second one does not do anything as it makes no narrative sense. The attacker is no longer being someone targeting the PC with an attack, and so is no longer a valid subject of the second effect.
If mirror image made someone target duplicate instead of protected character, then sanctuary has nothing to do as it only affects creatures targeting the warded person, per spell text. And attacker is no longer targeting warded person, he is targeting duplicate instead (again, per mirror image spell text).