INDIANAPOLIS — The seemingly impossible college basketball task — beating previously undefeated and No. 1-ranked Kentucky — not only became possible Saturday night, it became reality.

Frank Kaminsky scored 20 points and Sam Dekker added 16 as third-ranked Wisconsin stunned Kentucky 71-64 in an NCAA Tournament semifinal in Lucas Oil Stadium.

Wisconsin outscored Kentucky 13-4 in the final 4:26 to rally from a 60-56 deficit. Dekker’s 3-pointer with 1:41 to play broke a 60-60 tie and his free throw with 1:06 to go gave the Badgers a 64-60 lead.

“We caught them on a night when we were the better team,” said Dekker, whose clutch 3-pointer in last week’s West Regional final polished off Arizona and sent the Badgers to a second consecutive Final Four. “The three shot clock violations late in the game really helped us, and last year’s Final Four loss was motivation as well. We never doubted we could do this.”

Forward Carl-Anthony Towns led Kentucky (38-1) with 16 points and guard Andrew Harrison added 13.

Kentucky used a 16-4 run to take a 60-56 lead with 6:34 to go but scored only one more field goal and only four points the rest of the way.

“I am extremely proud, because we put ourselves in a hole, and we kept battling,” Wisconsin coach Bo Ryan said of a veteran team that starts two seniors and a junior. “We are nothing without our upperclassmen. We got them focused when they were young guys and now they are veterans. They showed that tonight.”

Wisconsin (36-3) iced it with free throws from guard Bronson Koenig and Kaminsky in the final 24.5 seconds.

Koenig and forward Nigel Hayes each added 12 points for Wisconsin, which will play Duke in Monday night’s national championship game. The Badgers, who lost a regular-season game to the Blue Devils, shot 47.9 percent from the field (23 of 48) against the Wildcats.

Kentucky, which defeated Wisconsin in the 2014 Final Four, shot 48.1 percent from the floor (26 of 54) but was outrebounded 34-22. Guard Aaron Harrison added 12 points for Kentucky, which most recently won the NCAA title in 2012.

“When we came into this season, our goal was to get better, not just get back here, but better,” Kaminsky said. “We watched a lot of film to see what we could take away from them. Late in the game, we were able to have some success doing that.”

The loss certainly was a bitter one for Kentucky, which was trying to complete what would have been the first 40-0 season had it won the NCAA championship.

“Wisconsin was able to do to us what we have done to teams all season,” Kentucky coach John Calipari said. “We were trying to run pick and rolls, and they finished the game. We struggled to guard them, and they outrebounded us.”

Kentucky’s Aaron Harrison was stunned.

“This season has been one of the best times of my life, but we didn’t finish it the way we wanted,” he said.

Towns said the Wildcats struggled to contain Kaminsky.

“He has lots of skills and uses his height to his advantage,” Towns said.

Forward Willie Cauley-Stein pointed to rebounding as the thorn in Kentucky’s side.

“We just kept fumbling rebounds … balls that we had,” Cauley Stein said.

Koenig’s jumper just before the buzzer pulled Wisconsin even at 36 at halftime despite Kentucky shooting 60 percent from the field (15 of 25) during the first 20 minutes.

Andrew Harrison led the Wildcats with 11 points in the first half and Kaminsky had nine for Wisconsin.

Consecutive field goals from guard Devin Booker and Harrison got Kentucky within 30-27 with 4:02 left in the half.

Kentucky grabbed a quick 5-0 lead at the start of the game, but Wisconsin battled back, tying the score at 9 on Dekker’s second field goal with 15:49 to play in a fast-paced first half.

With the score tied at 11, Wisconsin mounted a 7-3 burst to lead 18-14 with 11:27 left in the half. A Kaminsky 3-pointer with 10:33 to go gave the Badgers a 21-14 advantage and Calipari called a timeout. At that point, Wisconsin was outrebounding Kentucky 10-2.

The Wisconsin lead grew to 23-14 before Andrew Harrison scored with 8:29 left in the half for Kentucky.