“The Goldbergs” star Jeff Garlin says he was almost fired from the ABC sitcom this year after people complained about his language on the set.

Garlin, who plays gruff family patriarch Murray Goldberg on the ’80s-era series set in Pennsylvania, was called into HR. The issue? His colorful language between takes.

“I was saying some really stupid silly things that I can’t believe that anyone would find offensive, but to each his own,” Garlin, 57, tells The Post.

“Every time I stand up [on the set] I go, ‘Oh, my [female genitalia].’ Which is silly and stupid, I clearly don’t have [female genitalia]. And I said to them, ‘I understand if I worked at an insurance office and there’s a bunch of desks — that’s inappropriate. But in a comedic atmosphere it’s stupid. They said, ‘What if we fire you?’ and I said, ‘I’d love to have it announced Jeff Garlin got fired for saying [that].’ ”

Garlin emerged with his role intact. His standup special, “Our Man in Chicago,” is now on Netflix, and Season 10 of “Curb Your Enthusiasm” drops in January.

“I was filming ‘The Goldbergs’ at the same time that I was filming ‘Curb Your Enthusiasm,’ and at night I would go out and work on my standup set,” says Garlin about how he spent this spring and summer. “Right now I’m taking a little break from standup just because I need to re-energize myself.”

“Our Man in Chicago,” filmed in June in Garlin’s native city at the Park West theater, closes out in an unusual way — with Garlin addressing the camera, telling the audience at home to watch fellow comedian John Mulaney’s special. Garlin says he did it because he doesn’t view Mulaney as his competition.

“He’s the opposite of the competition. He’s somebody that brings me great joy,” he says. “I feel like people should know about him if they don’t. They would get a lot of joy from watching his special.”

On Jan. 19, he returns for Season 10 of “Curb Your Enthusiasm” as Jeff Greene, Larry’s (Larry David) manager and close friend who’s still married to foul-mouthed Susie (Susie Essman) despite his philandering.

Garlin says that, after all these years, his working relationship with David is seamless. “When we shoot a scene where it’s just Larry and me, it goes quickly, because we know how to work with each other so well,” he says.

“[Season 10] is my favorite season we’ve ever done. The premise is, to me, the funniest and smartest premise that we’ve done,” he says. “It’s something that everybody will be able to associate with.”

People constantly approach Garlin to ask about what David is really like — and Garlin says that’s fine with him.

“It doesn’t bother me, because I’d want to know, too,” he says. “I say he’s a great guy, and I love him.”