James Dolan was right. For a change.

Sparked by the Knicks owner’s guarantee of a victory in Atlanta and a new starting lineup featuring J.R. Smith, the Knicks turned Dolan into Joe Namath for one night at Philips Arena in busting up the Hawks Wednesday, 95-91, to erase the stench of Sunday’s matinee horror against San Antonio.

The Knicks built a 17-point lead in the first half, withstood the Hawks’ rally in which Atlanta went up six points in the fourth quarter and pummeled Atlanta down the stretch. The Knicks, who turned the ball over just three times, moved to 3-4 and delighted the large army of New York fans in the arena.

“Bottom line is we’re here to win,” coach Mike Woodson said. “Every time I step on the floor, I expect guys to win and I thought tonight was a total team effort.”

Carmelo Anthony shook off an awful third quarter and led the Knicks’ final rally to finish with 25 points (9-of-24 shooting). And Andrea Bargnani hit the game-clincher — a ridiculous banked 3-pointer — with 2:45 left to put the Knicks up 90-81. Dolan surely didn’t call glass, but he called this win. If the eccentric owner’s words served more as a motivation than irritant, so be it.

“Melo said something about it today,” Smith said of the guarantee. “When I heard it, I was like, more pressure. But it’s a good thing. Any owner who’s that enthused about his team, it’s a great thing.”

Dolan had made his guarantee on stage at a Manhattan blues club during his band’s performance Sunday night. “We’re going to win the next game, he said, “I guarantee it.’’

Woodson moved Smith into the starting lineup for Pablo Prigioni and it worked. Four of the five starters hit double figures, including Bargnani (20 points, 11 rebounds), Raymond Felton (10) and Smith (11).

The Knicks try to reach the .500 mark Thursday night at the Garden when Houston’s Jeremy Lin and Dwight Howard come to town.

Smith looked nothing like his San Antonio debut when he shot 1-of-9 with four turnovers.. He moved the ball, didn’t press and made his shots early. He hit his first three buckets — two from the 3-point line — notching nine points in the opening six minutes. It set a good tone as the Knicks raced to a 17-point lead in the second quarter and led 55-45 at halftime. Smith finished 4-of-10 from the field.

But it all came apart in a 23-10 third quarter and Dolan had to be singing the blues. The Knicks fell behind 78-72 with 8:16 left after a Kyle Korver 3-pointer.

Not to worry. The Knicks responded with an 11-0 run. Anthony scored on a wicked drive down the lane and then hit an ensuing 3-pointer to tie it at 78. Felton pull-up jumoer gave the Knicks an 80-78 lead with 6:08 left and Bargnani banged in a 3-pointer from up top to put the Knicks in the lead 83-78 with 5:49 left to cap the 11-0 run.