How to limit post query to only return a total count of items with certain post statuses?

WHERE post_status NOT IN ('auto-draft','trash')

Looks like you can add that to your base query.

/* -- Preparing your query -- */
$query = "SELECT * FROM $wpdb->posts WHERE post_status NOT IN ('auto-draft','trash') ";

This is only barely a WordPress question. Why are you not using core functions for this?

Also, NOT IN is not a very efficient query. This could be slower than you expect.