MINNEAPOLIS — The Rays’ Fourth of July game turned out to be a dud.

After letting a two-run lead get away in the seventh inning, the Rays were walked off in the ninth by the Twins and lost 4-3.

Harrison Bader, a former Florida Gator, homered on Kevin Kelly’s first pitch of the ninth.

The loss was the Rays’ fourth in their last five games and dropped them to 48-40.

The score was tied 3-all after seven innings.

The Twins took a 1-0 lead with one out in the fifth.

No. 9 hitter Bader launched Littell’s first pitch on a 412-foot ride into the second deck above leftfield.

The Rays didn’t get a man on base against Twins starter Chris Paddack until there were two outs in the fourth and Brandon Lowe singled, extending his hitting streak to 19 games, one shy of Yandy Diaz’s franchise-record 20.

By the sixth inning, they got two on base, around and in.

Josh Lowe led off with a single and was running on a 3-2 pitch that Diaz sliced to center at 112.9 mph, extending his on-base streak to 27 games. He scored when Junior Caminero delivered a one-out, broken-bat single to center.

The Rays made it 3-0 with a seventh-inning rally started by new shortstop Ha-Seong Kim, who was making his Tampa Bay debut after completing his rehab from October right shoulder surgery.

Kim singled and Chandler Simpson walked, though Kim was thrown out at third on the front end of an attempted double steal. That mattered less when Josh Lowe delivered a one-out single to right that scored Simpson and extended the lead to 3-1.

Littell gave the Rays six solid innings, allowing just the one run, four hits and two walks while striking out five.

The Rays turned to reliever Edwin Uceta, whose season has been marked by inconsistency. That continued as he allowed singles to two of the first three batters, then a two-out, run-scoring double to red-hot Byron Buxton.

The bullpen trouble continued as Garrett Cleavinger hit Willi Castro to load the bases, then pinch-hitter Brooks Lee to force in the tying run.

Saturday: at Twins

2:10, Target Field, Minneapolis

Pitchers: Rays — RH Taj Bradley (5-6, 4.79); Twins — TBA

TV/radio: FanDuel Sports Sun; 95.3-FM, 620-AM, 106.7-FM (Spanish)

Info: raysbaseball.com

On deck

Sunday: at Twins, 2:10. Rays, RH Drew Rasmussen (7-5, 2.78); Twins, RH Joe Ryan (8-4, 2.75)

Monday: at Tigers, 6:40. Rays, RH Shane Baz (8-3, 4.33); Tigers, RH Jack Flaherty (5-9, 4.80)

Tuesday: at Tigers, 6:40. Rays, RH Ryan Pepiot (6-6, 3.34); Tigers, TBA

Wednesday: at Tigers, 1:10. Rays, RH Zack Littell (7-7, 3.50); Tigers, TBA

Thursday: at Red Sox, 7:10. Rays, RH Taj Bradley (5-6, 4.84); Red Sox, TBA

Friday: at Red Sox, 7:10. Rays, RH Drew Rasmussen (7-5, 2.78)

Stay updated on Tampa Bay’s sports scene

Subscribe to our free Sports Today newsletter

We’ll send you news and analysis on the Bucs, Lightning, Rays and Florida’s college football teams every day.

You’re all signed up!

Want more of our free, weekly newsletters in your inbox? Let’s get started.

Explore all your options

July 12: at Red Sox, 4:10. Rays, RH Shane Baz (8-3, 4.33): Red Sox, TBA

July 13: at Red Sox, 1:35. Rays, RH Ryan Pepiot (6-6, 3.34); Red Sox, TBA

July 14-17: All-Star break