J. Edgar Hoover’s FBI secretly monitored David Frost’s US program to keep tabs on his left-wing guests – and once even planted an undercover agent in his New York studio audience, according to the famed Brit talk show host’s FBI file, obtained by The Post.

Guests that got the feds’ attention included Johnson-era Attorney General Ramsey Clark, economist John Kenneth Galbraith and black nationalist Stokely Carmichael among others, according to the 45-page dossier obtained under the Freedom of Information Act.

Other Frost guests on the FBI’s radar included folkie Joan Baez and Sen. Edmund Muskie, both critics of the Vietnam War, and Nixon Attorney General John Mitchell, who praised the bureau, the FBI memos revealed.

Perhaps the most bizarre guest to come under the feds scrutiny was “Viva” – aka Susan Hoffman – an actor described in one FBI memo as an “Andy Warhol ‘superstar’ [who] has been the featured female performer in many of his films.”

Viva earned the bureau’s ire because of comments she shared with Frost that were deemed “highly critical of the Government’s position” concerning an anti-Vietnam War activist.

“Warhol, of course, is regarded as the leading producer of so-called ‘underground films,’” the FBI memo said, noting that Warhol “was once the subject” of a past FBI criminal obscenity probe tied to his film “Lonesome Cowboys,” which starred Viva.

A March 1, 1971 FBI memo noted the flick was “typical of the type of thing Warhol deals in. It depicted homosexuality, male and female nudity, and was filled with obscene words, gestures, and phrases throughout.”

The memo did not recommend any follow-up action regarding Viva.

Hoover focused on Frost – who died at age 74 in August aboard the Queen Elizabeth – after the TV talker wrote to him on May 5, 1969 asking him to appear on “The David Frost Show,” which was about to debut on US TV as a replacement for “The Merv Griffin Show.”

“I am writing as a long time admirer of yours to ask if you would consider taking part in a special conversation for television,” Frost wrote in his fawning missive.

“I would love to have the privilege of talking with you . . . and television viewers throughout the world would love to hear,” wrote Frost, who first gained fame as a host of the satirical news show “That Was the Week That Was,” that aired in the early ‘60s in both the UK and US.

But the FBI boss – who had targeted dozens of celebs for surveillance, including Frank Sinatra, Bud Abbott and Lucille Ball – declined Frost’s invitation in a polite letter.

“I wish I could give you a more favorable response [but] the pressure of my official duties and the number of similar requests have made it necessary to decline all such proposals,” Hoover wrote.

Instead, Hoover ordered up a confidential FBI intelligence check on Frost – that revealed nothing of consequence – while arranging to have bureau agents watch the show to monitor its left-wing celebrity guests.

Over the next two years, during a volatile period in the country’s history marked by urban riots and violent anti-war protests, Hoover’s agents painstakingly noted any comments that could be considered un-American – as well as anything negative about the bureau itself, the FBI memos revealed.

Clark – now an 85-year-old West Village resident – was of special interest because of his outspoken anti-Vietnam War and civil libertarian views.

During an appearance on Aug. 5, 1969, Clark called wiretapping “immoral” and criticized the bureau’s approach to crime fighting.

But Frost then brought on NYPD detective Ralph Salerno to defend wiretapping, and the cop played a tape of two mobsters plotting to rub out an informant, an FBI memo said.

By January 1970, the bureau concluded that regular monitoring of the gab fest was a waste of time – but that certain shows should be watched depending on the guest list.

“Regularly monitoring of this program has proved to be entirely unproductive … daily monitoring should be discontinued,” the memo read.

That Nov. 18, however, an agent was sent into Frost’s audience, taking a seat for a live taping at the show’s West 44th Street studio of another appearance by Clark, who was sharing his views on crime and the Mafia.

The unidentified agent dissected Clark’s critical comments in a five-page memo passed along to bureau higher-ups, a month before the show was aired.

The agent also noted that Frost at the end of the show invited Hoover to appear to rebut the charges.

Agents also watched shows featuring Galbraith, who had personally disparaged Hoover and the bureau, and Carmichael, the “notorious black revolutionary” whom the feds said harbored “illogical” views.

Carmichael, according to an April 14, 1970 memo, “viciously attacked the US government as tyrannical and oppressive,” and argued that black entertainers were discriminated against on TV.

But the “audience …jeered his comments in this regard,” the memo noted.

The file also includes an Oct. 15, 1970 letter to Hoover from an unnamed citizen for not “disassociating himself” from remarks critical of then VP Spiro Agnew by guest Gore Vidal, who suggested that disgruntled Americans could “blow up the capitol AND Mr. Agnew!” according to the letter.

Hoover responded on Oct. 23, saying the FBI “has no control over who appears on television.”

The dossier – which also includes news clippings about Frost from The New York Times magazine – indicates FBI memos were routinely being funneled to Hoover’s two most trusted lieutenants, Associate Director Clyde Tolson and Cartha DeLoach, third-in-charge at the bureau.

There was no indication that Frost had ever been put under FBI surveillance apart from his show or been targeted by the FBI for wiretapping.

Frost – who finished his career hosting “Frost Over the World” on Al Jazeera English from 2006 to 2012 – forged a reputation as a consummate sophisticate, talented writer, comedian and bon vivant, was knighted by Queen Elizabeth in 1993.

Among his most famous interviews was his aggressive questioning of ex-president Richard Nixon in 1977. His shows also featured the Beatles, Muhammad Ali and eight British prime ministers.

Additional reporting by Bob Fredericks