What we’ll do is use Gmail’s filter capabilities to create a filter that automatically marks spam messages as read, preventing the unread count from appearing anywhere.

This method should work for both Gmail as well as any IMAP client that you use. (Note: This only works if you are using the new gmail interface.)

Mark All Spam as Read Automatically

Open up Gmail and then click the link to create a new filter. In the “Has the words” box, enter “in:spam” (without the quotes) as you can see in the image below. You can use the Test Search button to make sure it shows just spam emails.

Now click the Next Step button, and ignore the error message you get. Select the checkbox for “Mark as read”, and then click the Create Filter button. Note that you could auto-delete all spam using this same filter, although I’m not recommending that.

At this point, all incoming spam will be automatically marked as read. (You’d want to clear out the current spam, of course)

The best part is that you no longer have to deal with the unread count in your IMAP client either:

 

I don’t understand why some of this spam isn’t just automatically deleted.