Stan Van Gundy is going from ripping ESPN to joining it.

Van Gundy, who threatened to boycott the network last season, will be a studio analyst across the network’s array of shows, sources have told The Post.

January was not the first time he had been involved in a controversy with the network. Six years ago Van Gundy was nearly on ESPN’s air, but things fell apart, because in Van Gundy’s eyes, then commissioner David Stern, put the kibosh on the deal due to Van Gundy’s outspoken nature. At the time, Van Gundy said ESPN lied.

Now, Van Gundy will be joining ESPN, though, considering how it went last time, it should be noted he not yet signed his contract. Van Gundy’s brother, Jeff, is on ESPN’s top NBA broadcast team with Mike Breen and Mark Jackson.

Stan has coached the Miami Heat, Orlando Magic (whom he led to the Finals) and, most recently, was the president and coach of the Detroit Pistons.

With the Pistons, Van Gundy, 59, threatened to boycott ESPN after one of their reporters wrote a story in which LaVar Ball ripped Lakers coach Luke Walton. Lavar’s son Lonzo plays for the Lakers and the father suggested that Walton had lost the team.

“I thought it was a cheap shot and I thought ESPN showed total disrespect,” Van Gundy said. “I don’t have a problem with LaVar Ball. He’s a grown man. He can voice whatever opinion he wants. I got a problem with ESPN deciding that’s a story.”

At the time, Van Gundy threatened not to participate in interviews with ESPN. Now, he will talk on ESPN all the time.

Stan thought he was going to ESPN in 2012, but the network backed out of the perceived deal and released a statement that cited issues in the final stages of negotiating. Stan clearly thought it was Stern who blocked his path to Bristol.

“No one at ESPN will tell us what happened,” Van Gundy said on Dan Le Batard’s Miami radio show at the time, according to a transcript by The Big Lead.

“Certainly the NBA office isn’t going to tell us what happened. One of the quotes from ESPN in there – we had discussions, but couldn’t agree on a role … as is usual, that’s a bunch of BS from ESPN. We actually did agree on a role, but then they came back and pulled that. That’s when we knew something was up.”

Van Gundy went on to say, “What I find fascinating … you have to give David Stern and the NBA a lot of credit … ESPN pays the league, and then the league tells them what to do. It’s more ESPN’s problem. You gotta have no balls whatsoever to pay someone hundreds of millions of dollars and let them run your business.

“Just say what happened. Who cares? Who cares if I’m on there or not. Just come out and say this is what we decided and why … [ESPN’s quote] that’s just a flat out lie. Why would you do that? I don’t understand. We agreed on something, you changed your mind and pulled the offer. Don’t say we couldn’t come to an agreement. We did.”

Well, now ESPN has Van Gundy again and it appears SVG will make it to air this time.