This is the one that worked for me (on Sonoma 14.3)! Well, it required one more step: when I right-clicked the dock icon, and then clicked the single conversation (shown as phone number only) below "New Message", the Messages app showed "1 Conversation Selected," but I didn't see that conversation list on the left. However, from the conversation menu I was able to click Delete Conversation, and the badge went away!
WARNING: After the above, to assist writing this post, I right-clicked the Messages app on the dock icon's pop-up menu again, and it still showed that conversation! I clicked it and Messages again showed "1 Conversation Selected." But THIS TIME, when I clicked Delete Conversation, it deleted the previously-selected conversation (which was my pinned conversation with my wife!).