The Stanford football team might not want to remember many specifics from the 2019 season.

Especially a brutal 2½-minute stretch of Saturday’s game against Notre Dame.

The 17-point underdog Cardinal had a two-score lead and the ball with 4 minutes, 45 seconds remaining in the first half. But 2:25 later, the No. 15 Irish had rushed ahead by four points and were well on their way to a 45-24 victory on a cold and drizzly afternoon on the Farm.

“To those game-changing plays, we responded with resolve, but we didn’t respond by making more plays on our side,” Stanford head coach David Shaw said.

A season defined by a rash of injuries and mistakes uncommon during a program-best, 10-year run of bowl berths came to a bitter end Saturday, largely because of a second-quarter sequence that acted as a microcosm of the year.

Leading 17-7, Stanford quarterback Davis Mills’ third-down scramble came up inches short of securing a first down. For the first time since 2014, a Cardinal punt was blocked, and Justin Ademilola returned the loose ball to the Stanford 1-yard line.

Three plays and a false start later, Notre Dame quarterback Ian Book found Tommy Tremble for a 6-yard touchdown that trimmed the Cardinal’s lead to 17-14. Notre Dame took its first lead of the game less than two minutes later, when Book threw a 41-yard touchdown strike to Chase Claypool.

The Fighting Irish (10-2) never trailed again, scoring 31 straight points to secure their third straight season with double-digit wins and keep alive hopes of a spot in a New Year’s Six bowl.

The Cardinal (4-8) closed the season on a four-game losing skid for the first time since 2007, which was Jim Harbaugh’s first year as coach in Palo Alto and also the last time Stanford struggled through a four-win year.

“We just weren’t up to the task,” said senior linebacker Casey Toohill, who had a tackle for a loss and a pass deflection in his collegiate finale. “In life, it’s hard. We always look for these explanations. We want to explain these complex phenomena with simple solutions or answers, but it’s not simple.”

Stanford had won three of the previous four meetings with Notre Dame, including twice upsetting a ranked Irish squad. But this was a distinctly different Cardinal team, a squad that lost All-America left tackle Walker Little in the season opener and played nearly two-thirds of the season without NFL prospect quarterback K.J. Costello.

Mills showed promise as Costello’s replacement, racking up 1,070 passing yards in the season’s final three games, including going 28-of-46 for 276 yards against Notre Dame. But it wasn’t enough when combined with a struggling running game and an injury-depleted defense.

The Stanford running game, known for the better part of a decade for punishing opponents and dominating time of possession, managed just 189 yards on 61 carries (3.1 yards per carry) in the season’s closing three-game span.

Without cornerback Paulson Adebo and safety Malik Antoine patrolling the Cardinal secondary, Stanford allowed 255 yards and four touchdowns through the air. Book completed 17 of 30 pass attempts, including connecting five times with tight end Cole Kmet for 77 yards.

For the second straight week, the Cardinal players and coaches had to walk to the locker room as an opponent and its fans celebrated on their home field.

“I don’t worry about that,” Shaw said. “To the victors go the spoils. I plan on celebrating at a lot of other people’s fields next year.”

Rusty Simmons is a San Francisco Chronicle staff writer. Email: rsimmons@sfchronicle.com Twitter: @Rusty_SFChron