The founder of the Golden Krust Jamaican beef patty empire killed himself amid fears the feds were investigating him for evading millions of dollars in taxes, The Post has learned.

A family member told detectives that Lowell Hawthorne, 57, admitted the huge tax debt to some of his relatives, and was “acting funny” and “talking to himself” in the hours before his suicide, a law enforcement source said Sunday.

Surveillance video shows the meat-pie mogul shooting himself in the head at his office inside the Golden Krust bakery and warehouse in the Bronx, said the source, who was briefed on the NYPD investigation into the shooting.

Before the shooting, the video shows Hawthorne speaking with a pair of workers who left the room, both of whom were crouched down when they later returned to his office, sources said.

It was unclear if they saw Hawthorne kill himself, but one of them could be seen making a cellphone call, which a source said was to 911.

Hawthorne employed dozens of relatives at the business he started in 1989, and the source said he left a note in which he apologized to his family.

Hawthorne’s younger brother, Milton Hawthorne, 55, met cops who arrived at the Golden Krust plant at 3958 Park Ave. around 5:15 p.m. Saturday in response to a 911 call about an emotionally disturbed person armed with a gun, sources said.

Lowell, a married father of three sons and a daughter, was found on the floor of his office with a single bullet wound to his head and a handgun lying nearby, sources said.

The Jamaican immigrant started Golden Krust with a single fast-food eatery on East Gun Hill Road in the Bronx and opened 16 more across the city before launching a franchise operation in 1996.

The company now has more than 120 outlets in nine states, and sells its beef patties in more than 20,000 supermarkets, as well as to the city school system, state penal system and US military, according to a news release issued last year.

In August, Hawthorne was slapped with a proposed class-action suit alleging he cheated as many as 100-plus workers at the Golden Crust plant out of overtime pay.

The suit — fairly common in the food service industry — remains pending in Manhattan federal court.

Al Alston, who befriended Hawthorne 30 years ago when they were both NYPD accountants and now owns a Golden Krust franchise in Queens, called his suicide “more than unexpected — it’s out of character.”

“He was always an upbeat guy,” Alston said.

“We’ve been in a lot of tough jams and situations, but he was always a person who’d say, ‘We’ll get out of it.’ And we would get out of it.”

Alston said he last spoke to Hawthorne two weeks ago, adding: “He was so happy about [the recent birth of] his granddaughter.”

“All his boys are married now. He was talking about taking on a different role as a father, making his boys into husbands and fathers themselves,” Alston said.

Mourners gathered at Hawthorne’s home in Elmsford, with son Omar, Golden Krust’s director of franchise and community development, saying via email: “We are still grieving, and are not conducting any interviews at this time.”

During a brief news conference at the Golden Krust bakery, company spokesman and Hawthorne nephew Steven Clarke said widow Lorna Hawthorne was making funeral arrangements and it was unclear if there would be a public memorial service.

“Right now we’re still processing and trying to wrap our mind around this tragic loss,” he added.

Additional reporting by Daniel Prendergast, Reuven Fenton, Shari Logan and Tea Kvetenadze