It wasn’t pretty, but when the time comes to fill out the NCAA tournament dance card, UMass’ gritty, 70-67 win against pesky Rhode Island last night won’t hurt its chances to punch a ticket.

“I’m happy with the win. We picked up at the end of the half, and it was nip-and-tuck the rest of the way,’’ said Minutemen coach Derek Kellogg, whose team swept the season series from the Rams. “We showed a lot of character down the end. I think we scrapped on the boards. I think we needed it for the win column. Every game is important, and I think we needed to get to 22-23-24 wins.’’

UMass (22-5, 9-4 Atlantic 10) began ice cold, missing its first eight shots and turning the ball over three times as Rhode Island (12-17, 3-11) opened an early lead. The Minutemen went almost five minutes without a field goal until Maxie Esho connected on a pull-up with 15:04 left.

The Rams’ margin grew to 21-8 with 8:01 remaining.

“We have to come out stronger in the first half,’’ said UMass guard Derrick Gordon (nine points, 10 rebounds), whose team shot a woeful 28 percent (11-of-38) in the first 20 minutes.

Senior guard Chaz Williams (16 points, six assists) appeared particularly out of sorts, missing his first three from the floor. Yet his high energy and speed helped bring UMass back. The Minutemen surged ahead, 31-28, on a jumper by Gordon off a Williams assist, and the Rams got a hoop from E.C. Matthews (14 points) to make it 31-30 at the break.

The Rams demolished their more athletic opponents on the board, 24-8, in the first half and shot 52 percent (13-of-25).

“We probably should have been up by seven or eight points. We had chances,’’ URI second-year coach Dan Hurley said. “They just did a great job of attacking the rim, especially in the second half.’’

UMass burst out of the locker room with an 8-0 run to grab a 39-30 lead, forcing URI to call a timeout. Included in the spurt was a pair of crowd-pleasing dunks by 6-foot-9 senior Raphiael Putney.

The Rams, behind senior guard Xavier Munford (16 points) and Rutgers transfer Gilvydas Biruta (team-high 17 with eight rebounds), refused to roll over and regained the lead, 55-54, after Jarelle Reischel made 1-of-2 free throws with six minutes left.

It was a nail-biter the rest of the way, with the clubs never separated by more than two points until the end. A slashing drive down the lane by Gordon put the hosts ahead for good, 66-64.

“My confidence is building and building,’’ Gordon said. “If I miss a shot, I’m not going to get down on myself. That shot came at the right time.’’