Maryland men’s basketball entered Sunday’s game against Wisconsin with a 12-2 home record and a 1-6 road mark, a disparity guard Kevin Huerter credited to Xfinity Center’s energizing atmosphere.

But unlike last weekend, when the Terps rushed out to a double digit lead over then-No. 6 Michigan State to send their fans into a frenzy, coach Mark Turgeon’s squad was sluggish from the outset against the Badgers.

Fortunately for Maryland, the 10th-place Badgers did not possess the firepower to capitalize on that dreary home display. So, despite scoring just 11 points in the first 10 minutes and allowing Wisconsin to hang around into the final stretches, the Terps held on for a 68-63 win.

“We figured it out at the end,” Turgeon said. “It wasn’t pretty the whole time.”

After Wisconsin guard Brad Davison drained a 3-pointer to cut Maryland’s lead to 64-63 with 10 seconds left, guard Anthony Cowan’s free throws secured the narrow victory and helped him to a game-high 23 points.

The Terps (16-9, 5-7 Big Ten) closed the first half on a 17-2 run, turning a five-point deficit with about eight minutes left into a 10-point lead at intermission.

But Maryland lost its form again in the second half, not scoring for a three-minute span and allowing the Big Ten’s 12th-best offensive rebounding team to secure seven of its own misses in the first 10 minutes. After a 6-0 run brought Wisconsin (10-15, 3-9) within striking distance, the Badgers tied the game, 42-42, with 11:20 remaining.

“We were really bad, to be quite honest with you, to start the second half,” Turgeon said. “Shot selection, defense, concentration, everything. And I was mad at them, so I didn’t call timeout.”

Eventually, Turgeon said, his team’s defense improved and rescued the Terps from their tailspin. Still, neither team led by more than two points for the next six minutes. Finally, a 7-0 run sparked by a 3-pointer from Cowan put the Terps up 60-55 with 3:36 to play.

Neither that nor Maryland’s four-point lead with 27 seconds left — provided by back-to-back buckets from Huerter (19 points) — was enough to put the Badgers away. Davison’s 3-pointer kept Maryland sweating a disastrous result on its home court, but Cowan’s free throws and a block from guard Dion Wiley pushed the Terps to the final buzzer.

“It felt like we had to win it a couple of times,” Huerter said.

All season, Turgeon has bemoaned the intense difficulty of his team’s conference schedule.

What he was really commenting on, however, was the opening portion of the slate, which Maryland completed without picking up a single notable win.

Of the team’s last six games, just two are against teams that entered Sunday above .500 in the middling Big Ten. So, for the next three weeks, Maryland has to hope wins over uninspiring opponents such as Wisconsin are enough to propel it back into the NCAA tournament picture.

And, given the Terps’ propensity for subpar performances against lowly opponents — barely scraping past Bucknell, trailing Division-III Catholic midway through the first half, scoring 18 first-half points against UMBC — it seems likely Sunday’s win wasn’t the final time they’ll be pushed to the brink by a mediocre foe.

“All we can do is just keep on fighting,” Cowan said. “We just can’t stop right now. It’s no time for us to put our heads down. We’ve just gotta keep going.”