Every rock star who came up in the 1970s dreamed of hanging out with David Bowie. Debbie Harry, the sex-kitten lead singer of Blondie, had her chance when her band toured with Bowie and Iggy Pop in 1977 — but she got a lot more than she bargained for.

One night while in New York, the two men let her know they were looking for cocaine, as their dealer had suddenly died, so Harry produced a gram that she had lying around.

The drug-loving stars consumed it in a single snort each, then Bowie showed his appreciation.

“He pulled out his c–k, as if I was the official c–k checker,” Harry writes in her candid new book, “Face It” (Dey Street Books), out Tuesday. “David’s size was notorious, of course, and he loved to pull it out for men and women. It was so . . . sexy.”

Her only complaint? “I had to wonder why Iggy didn’t let me have a closer look at his d–k.”

Needless to say, Harry was no shrinking violet. She also recalls how she gave onetime boyfriend Penn Jillette the idea of having his Jacuzzi’s water jets custom-positioned for clitoral stimulation.

“Penn patented the orgasmatron tub,” Harry writes. “I kept expecting his wife to at least send me flowers.”

The singer hit it big in the late 1970s and early ’80s with songs including “Heart of Glass” and “Call Me,” but her path to New Wave infamy was littered with drugs, gunplay and a weird run-in with one of the world’s most notorious serial killers.

Late one night in the ’70s, while walking through the not-yet-gentrified Lower East Side en route to a party for the New York Dolls, Harry accepted the offer of a ride from a handsome man in a small white car. Once inside, though, she was alarmed to discover that the driver had terrible body odor and the window would not open beyond a crack.

Panicked and operating on instinct, she wedged her hand into the crack and opened the door from the outside. Pissed off, the driver made a sharp turn that propelled her from the car. She rolled onto Thompson Street and walked to the party.

Years later, Harry read a story in a newsweekly and realized that the stinky driver was serial killer Ted Bundy. The article described “the modus operandi [of] how he got his victims and it matched exactly what happened to me,” she writes. “The hairs on the back of my neck stood up.”

“My story has been debunked since, because Bundy is said to have been in Florida at the time and not NYC. But it was him.”

It was not her only brush with danger.

Following a performance with the Ramones in Los Angeles, Blondie got invited to the home of gun-loving record producer Phil Spector, who would later serve time for murder. With a Colt .45 within easy reach, he went from entertaining his guests with W.C. Fields impressions to sitting at the piano and playing the Ronettes’ greatest hits. He pressed Harry to sing along on songs like “Be My Baby,” even though she was trying to preserve her voice.

“Phil took out his gun, stuck it into the top of my thigh-high leather boot, and said, ‘Bang, bang!’ ” writes Harry. “He was a genius, he had a gun and his paranoia was enormous . . . That doesn’t always end well.”

When she and her longtime boyfriend, Blondie guitarist Chris Stein, were living in a rent-controlled apartment at First Avenue and First Street, a Jimi Hendrix lookalike with a knife forced his way into their apartment, she writes. He tied them both up before gathering Stein’s guitars and cameras — but turned down their offer of the LSD they kept in the freezer. The robber then forced Harry to have sex with him and offered a parting salvo: “Go clean yourself up.”

Looking back, Harry writes, “I’m very glad this happened pre-AIDS or I might have freaked. In the end, the stolen guitars hurt me more than the rape. We had no equipment.”

When times were lean, Harry writes, she and Stein bought marijuana — sometimes purchasing as much as 2.2 pounds at a time — and resold it to friends. But Harry said it wasn’t her preferred drug.

“I couldn’t handle it at all,” she writes. “I’d find myself either floating above my body in a state of blank catatonia or in complete paranoia.”

In 1983, Stein came down with a debilitating autoimmune disease called pemphigus vulgaris, which causes painful blisters to develop, and spent three months in Lenox Hill Hospital.

While the facility had no shortage of painkillers, Harry says she utilized her own prescriptive.

“I kept him supplied with heroin,” she writes. “He was on heroin the whole time he was in the hospital . . . It kept him relatively pain-free and mentally less tortured.”

The same went for Harry: “I was most certainly indulging, too, staying as numb as possible.” Only she was adding cocaine to her regimen, even though she didn’t love the drug.

“I didn’t care for coke too much — it made me jittery and wired and it affected my throat,” Harry writes.

To make matters worse, while Stein was ill, “terrible contracts,” bad business decisions and neglecting to pay taxes came home to roost.

“The IRS took away everything they could get their hands on,” Harry writes, including Harry and Stein’s health insurance. (Stein did not respond to an email from The Post seeking comment.)

“They took my car. They even took my coats — which was bizarre . . . What were they possibly going to get for them?”