Problem: Messages for macOS has a numbered badge but you can’t find any unread messages.

Solution: Choose View -> Unread Messages then switch back to View -> All Messages, and that will clear the badge.