A New York state court threw out a defamation suit by Kenny Kramer — the inspiration for the “Seinfeld” ­television show character Cosmo Kramer — against a ­former show writer and guest whose book dissed Kramer’s “Seinfeld”-based bus tours.

Kramer sought $1 million plus punitive damages from Fred Stoller and Skyhorse Publishing Inc. Kramer claimed the book’s negative passage about a tour employee screaming the show’s Fred Stoller catch phrase about homosexuality — “Not that there’s anything wrong with that” — harmed his reputation.