The “bomb guru” for the terrorist group the Weather Underground never served a day in jail — but he did spend decades teaching in New York City classrooms, a new book reveals.

Ronald Fliegelman built explosives for the Weather Underground, a far-left group that launched a domestic bombing campaign in the 1960s and ’70s, including one explosion inside NYPD headquarters.

But when the group dissolved, Fliegelman managed to safely fade away into the square life. For 25 years, he worked as a public special-education teacher, retiring to a quiet life in Park Slope, Brooklyn, according to “Days of Rage: America’s Radical Underground, the FBI, and the Forgotten Age of Revolutionary Violence” (Penguin Press).

And he’s unapologetic about his past, according to author Bryan Burrough.

“Ron is proud of what he did,” he told The Post.

The Weather Underground first organized in 1969 as a splinter of the Revolutionary Youth Movement within the ’60s protest group Students for a Democratic Society.

Their members were mostly white and middle-class, advocating the complete overthrow of the US government.

Under the leadership of co-founder Bill Ayers — who went on to become a University of Illinois professor whose political relationship with then-candidate Barack Obama was scrutinized during the 2008 presidential campaign — the group also pushed for a sexual revolution.

Their slogan? “Smash monogamy.”

“Without him, there would be no Weather Underground.” - Brian Flanagan, former Weatherman

To achieve their goals, the militant group — popularly known as the Weathermen, derived from the Bob Dylan lyric, “You don’t need a weatherman to know which way the wind blows” — embarked on a years-long bombing campaign, targeting places it considered pillars of US imperialism, capitalism, racism and anything contrary to their “ism” of choice: communism.

To protest the US invasion of Laos, for example, they bombed the Capitol Building in 1971. That same year, they targeted the headquarters of the state Department of Corrections in Albany for the deaths of 29 inmates during the Attica prison riot. They even busted LSD guru Dr. Timothy Leary out of a California jail and helped smuggle him to Algeria in 1970 — the same year they issued a “Declaration of a State of War” against the United States.

“We believed Third World countries would rise up and cause crises that would bring down the industrialized West, and we believed it was going to happen tomorrow, or maybe the day after tomorrow,” a former Weatherman tells Burrough.

“The myth, and this is always Bill Ayers’ line, is that Weather never set out to kill people, and it’s not true — we did,” group member Howie Machtinger tells Burrough. “You know, policemen were fair game.”

Despite the tough talk, the group was already in crisis not long after its formation.

On March 6, 1970, a bomb exploded prematurely inside a town house at 18 W. 11th St. in Greenwich Village. Three Weathermen were killed — the two building the bomb, Terry Robbins and Diana Oughton, and another, Ted Gold, who was entering the building.

If the Weathermen were going to wage a war, they needed to do so without killing their own members, Burrough notes.

“No one knew what to do. I gave a thought to giving up, and I had a gun pulled on me and was told I was not leaving,” recalls Fliegelman.

The son of a Philadelphia doctor, Fliegelman got his start with Students for a Democratic Society, where he gained a reputation for being a technically proficient workaholic, once manually printing hundreds of leaflets when the mechanical printer broke down.

“Fliegelman was the one person who knew how to strip down and reassemble guns, motorcycles and radios, who knew how to weld, who could fix almost anything,” writes Burrough.

He looked the part, too.

One member described him as possessing “a Santa Claus twinkle in his eye that inspired confidence.”

“Everyone was afraid of the stuff, for good reason,” Fliegelman says. “What we were dealing with was a group of intellectuals who didn’t know how to do anything with their hands. I did. I wasn’t afraid of it, I knew it could be handled.”

After the Village town house explosion, Weather Underground founding member Jeff Jones summoned Fliegelman to a meeting in Central Park.

“You either know how to build something or you don’t,” Fliegelman says.

“[Jones] said, ‘Well, what do we do?’ And I said, ‘This can never happen again. I’ll take care of it.’ And I did.”

From that day on, Fliegelman spent hundreds of hours studying explosives.

“When you’re young and you’re confident, you can do anything. So, yeah, you play with it, and try to build something. The timer is the whole thing, right? It’s just electricity going into the blasting cap,” he says.

“Eventually, I came up with a thing where I inserted a lightbulb, and when the bulb lit, the circuit was complete, and we were able to test things that way. If the light came on, it worked. The rest of it is simple.”

Members recognized his contribution.

One member described him as possessing “a Santa Claus twinkle in his eye that inspired confidence.”

“Without him,” former Weatherman Brian Flanagan tells Burrough, “there would be no Weather Underground.”

From then on, Fliegelman says, he built most of the group’s bombs, even jetting off to the San Francisco Bay Area to help members there.

“Maybe they did two or three things without me,” he tells Burrough. “But I doubt it.”

His first attack, in 1970, was the most nerve-racking. And why not? They were going inside NYPD headquarters.

“That first one was the scariest,” Fliegelman recalls. “Going into a public building, there was security, and you had to get past it. We had people who did the casings. We needed people who wouldn’t be noticed, so they went in dressed like lawyers. Still, I was scared. Very scared. We knew if we did this, they would come after us.”

But things went smoothly.

“It wasn’t like they had metal detectors back then. There was just a guy at the desk, and we walked right past him,” Fliegelman tells Burrough.

The bomb — created in an apartment on quaint Amity Street in Cobble Hill, Brooklyn — had a simple design: 15 sticks of dynamite attached to a Westclox alarm clock bought at a RadioShack.

The device, hidden in a hollowed-out law book, was placed above a ceiling tile in a second-floor bathroom at the Centre Street building, about 125 feet from Commissioner Howard Leary’s office.

At 6:40 p.m. on June 9, a warning was called in, and 17 minutes later, the bomb exploded, destroying two walls and blasting a 20-by-40-foot hole in the floor.

Mayor John Lindsay promised a “relentless” investigation, but that didn’t slow down Fliegelman, who built the bomb that blasted a toilet in the Corrections offices in Albany, Burrough writes.

“Tonight we attacked the head offices of the New York State Department of Corrections,” the group boasted afterwards.

“We must continue to make the Rockefellers, Oswalds, Reagans and Nixons pay for their crimes. We only wish we could do more to show the courageous prisoners at Attica, San Quentin and the other 20th-century slave ships that they are not alone in their fight for the right to live.”

Fliegelman’s memory gets hazy when asked about the Capitol bombing of 1971. He says he “believes” he built the device placed in the first-floor men’s room near the Senate, which caused about $300,000 in damage, according to Burrough.

And he says he can’t remember whether he built the bomb that went off in a fourth-floor restroom at the Pentagon in 1972 in retaliation for US raids in Hanoi.

“Fliegelman was the one person who knew how to strip down and reassemble guns, motorcycles and radios, who knew how to weld, who could fix almost anything.” - Author Bryan Burrough

Burrough says Ayers, in his memoir, “Fugitive Days,” refers to Fliegelman’s involvement in the Pentagon caper, calling him by the pseudonym “Aaron.”

“Aaron was the backbone of the group — entirely committed and trustworthy, hardworking and dependable . . . A guy we all believed could easily survive in the Australian Outback or the Siberian wilderness for weeks with nothing but a pocket knife . . . The model middle cadre,” Ayers writes.

The group began to dissolve after a peace accord was signed to end the Vietnam War in 1973, and four years later, it was defunct.

By then, Fliegelman was living with fellow Weatherman Cathy Wilkerson, a bomb-maker in her own right.

The two had a daughter and split up. Fliegelman, meanwhile, simply returned to his parents’ home in Philadelphia, working at a school for troubled children, abandoning his bomb-making ways as easily as a snake sheds its skin.

“For me, it was really seamless,” he tells Burrough. “No one — the FBI, no one — ever came looking for me.”

Fliegelman was among 13 Weathermen indicted on charges of conspiring to commit bombings and assassinations, but the indictment was dropped in 1973 by the Justice Department in the wake of a Supreme Court decision that barred the use of electronic surveillance without a court order.

Fliegelman was underground at the time and never arrested, Burrough notes.

There’s a five-year statute of limitations on most federal crimes except for murder, so by the time he began working for the city in 1983, Fliegelman didn’t have to look over his shoulder.

He started as a special-education teacher at PS 54 in Bedford-Stuyvesant, Brooklyn, and later taught at PS 305, also in Bed-Stuy, according to the Department of Education. He retired in 2006.

Now 70 years old, Fliegelman collected $40,035 in pension last year, according to public records.

His life now appears to have taken on all the trappings of the leisure class. On Thursday, he was seen walking a small white dog in idyllic Park Slope before climbing into a Subaru Forester SUV.

Approached by The Post, Fliegelman, who wears a neat ponytail, said: “What happened 40 years ago is different from what’s going on today. War was a big thing. It was on TV every night. You don’t know that with the Iraqi war, the Afghanistan war. There was the draft, as well.”

Asked whether he considered himself a terrorist, he said: “Did you ever notice how many people were hurt by our bombs? People were not hurt by our bombs.”