From time to time I get my Mail.app (the standard mail client on macOS) showing me a number of phantom unread emails. When I try to find them, by checking the list or using smart mailboxes, no unread emails are there to spot.
I tried by selecting the mailbox and performing a secondary click to select ‘Mark All Messages as Read’. This sometimes helped, sometimes it didn’t.
So I’ve googled a bit, and found another possible solution. It helped me, so if you also experience a similar issue it could also be of help for you.
Be my guest:
From mail, click on the mail account that has the phantom unread e-mails. Go to the mailbox tab across the top menu, then select rebuild. This rebuilds the mailbox from your IMAP account and has fixed the problem for me everytime.