Maryland extended its lead to 16 early in the second half as its offense was thriving and its defense had largely held Indiana in check.

Then the latter, which had been the lone bright spot throughout the Terps’ tumultuous campaign, began to crumble.

The Hoosiers made shot after shot — 12 in a row to pull within two of the Terps. When they finally missed, Trey Galloway followed the shot, grabbed the offensive rebound and scored a putback layup.

The make gave Indiana its first lead nearly 20 minutes. The Hoosiers used a 15-0 run late to take an 11-point lead with less than four minutes to go. The Terps cut their deficit to five late with back-to-back three-pointers from Donta Scott and Jahmir Young, but never came closer after falling behind.

Maryland men’s basketball’s second-half collapse led it to an 83-78 loss against Indiana on Sunday in College Park. The Terps dropped their final game of the year at Xfinity Center and fell to .500 with a loss in their penultimate regular season contest.

The Hoosiers (16-13, 8-10 Big Ten) shot 73.1 percent from the field and went 40 percent from three in the second half while outscoring the Terps 50-35. Indiana freshman Mackenzie Mgbako scored a career-high 24 points as the Hoosiers swept the Terps in the season series.

Sunday marked the first time Maryland gave up 50 points in a half under coach Kevin Willard.

[DeShawn Harris-Smith gives Maryland hope for future amid a grim season]

“We lost [Mgbako] in transition three times. Even in the first half, two of their threes were in transition,” Willard said.

“They were beating us down the court.”

The Terps’ three leading scorers helped them to one of their best first-half offensive performances this season.

Maryland (15-15, 7-12 Big Ten) scored 43 points in the opening 20 minutes, its second-best first-half mark against a Big Ten opponent this season.

Young led the way early and thrived near the basket, unbothered by the post presence of 7-foot Indiana center Kel’el Ware. The fifth-year senior got multiple tough layups to fall throughout the first half and went 5-for-7 from two-point range.

Julian Reese and Scott both grew into the game and notched double-digit points by the end of the half.

Reese scored multiple short jumpers and finished the opening half with 11 points and six rebounds. Scott missed his first four shots but went 3-for-5 from three-point range, including a deep make with the shot clock winding down late in the half, to enter halftime with 11 points.

Indiana turned the ball over nine times to Maryland’s three in the first half, and the Terps capitalized by scoring 10 points off those giveaways.

[Maryland assistant Mike Jones to take Old Dominion head coaching job]

Maryland’s strong defense helped it go on multiple long runs where the Terps scored double-digit unanswered points and take a 43-33 lead into the break.

Jahari Long opened the second-half scoring with makes on Maryland’s first two offensive possessions of the frame, driving to the basket for a layup before nailing a fastbreak three-pointer. The Seton Hall transfer finished with 12 points on his senior day in only his third start for the Terps.

A Young and-one on the Terps’ next possession gave them a 16-point lead — their largest of the day.

Indiana started the half with a pair of misses but made 12 straight field goals and pulled even with Maryland with just less than nine minutes to go.

“At the end of the day it comes down to who’s making shots and getting stops,” Scott said.

Geronimo, who didn’t score against his former team in a 65-53 loss to the Hoosiers in December, hit a three-pointer and made a layup in transition as the Terps attempted to stave off a surging Indiana.

Young, Scott, Long and Geronimo, who were all honored during senior day festivities before the game, scored at least nine points Sunday.

Young and Scott were subbed out in the last minute of the game and shared an embrace with Willard before watching the final seconds of their Maryland careers at Xfinity Center tick away — capping the final moments of a disappointing year at home with another brutal loss.

“The season didn’t go as well as we wanted it to be, but [we’re] just trying to keep our heads high,” Scott said.