Knicks coach Derek Fisher was attacked in Los Angeles by NBA bad boy Matt Barnes, who drove 95 miles to “beat the s—t out of him” when he found out Fisher was romancing his estranged wife, sources told The Post on Wednesday.

The 6-foot-7 Barnes, who now plays for the Memphis Grizzlies, made a fast break from his team’s California training camp Saturday when he was tipped off that Fisher was making time with sultry “Basketball Wives LA” star Gloria Govan in the home Barnes once shared with her.

The NBA is investigating the brawl.

Sources told The Post that Barnes became incensed when his 6-year-old twin sons, Carter and Isaiah, called to tell him that Fisher was at the house.

“Barnes went crazy. He got in his car and went to the house and went after Fisher,” one source said. “Matt then drove down there to beat the s–t out of him.”

Fisher and Barnes were teammates on the LA Lakers for two seasons.

Barnes — a forward who’s known as an “enforcer” for his aggressive style of play — found Fisher, Govan and about 10 other people around a bonfire in the back yard, sources said.

A fight erupted at 11:45 p.m. between the 235-pound Barnes and the 6-1, 200-pound Fisher. Cops were called, but Fisher left before they arrived, the sources said.

Following the dustup, Barnes, 35, texted a pal that he had not only assaulted Fisher, 41, but also took revenge on Govan, one source said.

“I kicked his ass from the back yard to the front room, and spit in her face,” the text read, according to the source.

A source close to Fisher confirmed the fight, but insisted it wasn’t as one-sided as Barnes claimed.

“Matt came after Derek, but he only had a few scratches,” the source said. “Derek’s not going to press charges; he’s going to let it go.”

Fisher, who declined to comment in detail about the dustup, looked no worse for wear before the Knicks’ preseason game against the Brazilian Paschoalotto/Bauru team at Madison Square Garden on Wednesday night.

Govan was planning to file a restraining order against Barnes, sources said.

Reps for Barnes and Govan didn’t return requests for comment. The Grizzlies issued a statement saying they were “aware [of] and currently gathering information regarding” The Post’s online exclusive on the incident.

Asked how he felt in the wake of the fight, Fisher said, “My state of mind — like I talked to the guys a few minutes ago — is personal, and private matters are personal and private.

“I’ve been through a lot in life. Sometimes, we go through things we can’t or can control. I’m here. I’m focused. It’s not something that’s going to take me away from what we’re trying to do.”

Fisher refused to say why he missed the team’s practice on Monday, which the Knicks had tweeted was “due to personal reasons.”

LA court records show Barnes filed for divorce in January. In August, he claimed that he had been dating pop star Rihanna and that they’d gone “past the crush stage,” but she denied it on Instagram.

Sources said Fisher began dating Govan, 29, “a few months” ago, and on Sept. 27, a Twitter user with the handle @alexiss_henry tweeted: “I spy Derek Fisher with Matt Barnes’ kids.”

In March, Fisher filed for divorce from his wife, Candace, a month after their 10th anniversary.

Candace, who has twin sons with the coach, responded with court papers saying she was “blindsided” by the move and discovered he had secretly moved his stuff out of their New York apartment when she went to check on it, according to TMZ.

Saturday’s altercation wasn’t the first time Barnes has flashed rage.

In 2012, he was arrested for allegedly threatening a California cop who recognized him for an outstanding warrant for driving with a suspended license.

He was also arrested in 2010 on suspicion of felony domestic violence against Govan, who was his fiancée at the time.

She denied he had abused her during a fight at their home, and the charge was later dropped.

Earlier this year, the NBA fined Barnes $50,000 for directing “inappropriate language at a fan” who was seated courtside during a May 1 playoff game — and who turned out to be the mom of Houston guard James Harden.

The NBA didn’t detail the trash talk, but reports on Twitter claimed that Barnes, who later apologized, said, “Suck my d- -k, bitch.”

Barnes was also fined $25,000 in January for kicking water and cursing at a fan in Washington.

Later that month, he was fined another $25,000 for swearing at Phoenix Suns owner Robert Sarver, who Barnes later said “cussed at me” first.

Barnes met Govan when she was 12, and they started dating in 2006, when he played for the Golden State Warriors. The couple married in 2012.

Additional reporting by Bruce Golding and Marc Berman