John McEnroe says the Studio 54 era wasn’t all it was cracked up to be — admitting he couldn’t even get into the storied club — and he even calls Andy Warhol “annoying” and “mediocre” in his upcoming memoir.

The tennis enfant terrible recalls in “But Seriously,” out Tuesday from Little, Brown and Co., that he could never get past the velvet rope at Studio 54, pleading with its infamous doormen, “I’m six in the world!” But, “the doormen would be like, ‘So? McEnroe, get the hell out of here!’ In fact, I don’t think they even knew my name — my memory has added that in the hope of making me feel better.”

Of Warhol, McEnroe writes, “He was always there at every party I was ever at, taking your picture late at night, even when you were super f - - ked up . . . I remember thinking, ‘Who is this weirdo with the fake hair? Why is he waving his camera around when we’re here at 3 in the morning? Isn’t there a place that could be off-limits?” (Warhol was known for taking Polaroids of everyone, including Mick Jagger, Yves Saint Laurent, Jack Nicholson, Debbie Harry, Alfred Hitchcock and Pelé.)

But in his book, McEnroe complains that Warhol interfered with his sex life, saying that at late-night parties, where one might “loosen your collar and try to find a good-looking model or whatever,” the artist “always seemed to be up in everyone’s face with his camera, being a pain in the ass.”

The seven-time Grand Slam winner didn’t think much of Warhol as an artist either, saying he found him to be “mediocre” before he later came to appreciate the work. When Warhol died in 1987,

McEnroe says, “everyone all of a sudden is going, ‘He’s one of the world’s greatest, unbelievable. . .’ I’m like, ‘He is?’ ”

Yet McEnroe spent about $30,000 at a 1986 charity auction to have Warhol paint a pair of portraits of himself and then-wife Tatum O’Neal. The artist came to their home to photograph them first.

The tennis star-turned-broadcaster eventually sold the works for more than $400,000 at a Sotheby’s charity auction in 2008.