Just like Tom Hanks’ beloved character in the 1994 classic “Forrest Gump,’’ Kostelnick started on one end of the US — on the steps of San Francisco’s City Hall on Sept. 12, his birthday — and just kept running.

By the time he hit the Jersey side of the George Washington Bridge on Monday, exactly 42 days and about 2,900 miles later, he had gathered a mob of 10 fans who started running with him.

Caption

As with Hanks’ character, when Kostelnick stopped for a minute, such as to retrieve a dropped water bottle, the crowd stopped. When he moved, they all did.

The group gathered steam as it ran south of West 125th Street and along Central Park, growing to about 25 people.

As Kostelnick neared Midtown, several men in business suits joined his journey, running for several blocks with him.

Bystanders chanted, “Run, Pete, run!” and “Forrest Gump!”

The fleet-footed financial researcher, an Iowa native who now lives in Nebraska, said he had been to Manhattan before and felt right at home running on Sixth Avenue — because he had once chased a bus along the street on foot.

When Kostelnick reached City Hall at around 5:45 p.m. — after 42 days, 6 hours, 34 minutes and 6 seconds on the road — he had shattered the previous record of 46 days.

As he crossed the line marking the end of his odyssey, Kostelnick quipped, “Well, I’m definitely not going to run back.

“All I want is a beer and my wife,” he said.

By Kostelnick’s own admission, he hardly began as a running prodigy.

He dipped his feet into the sport initially to lose weight but found that not only did he like to run — he was pretty good at it.

He swiftly conquered the marathon and found his true calling was super-long-distance ultrarunning.

One of the first races Kostelnick entered as an ultrarunner was the RAGRBRAI fund ride across Iowa — for bikes.

He ran 423 miles in seven days, finishing ahead of some cyclists.

He has since won the prestigious Badwater135 Ultramarathon two years in a row, setting the course record in 2016, and ran 163.68 miles in 24 hours in 2015.

Kostelnick then set his sights on running across country — and shattering the Guinness record while he was at it.

His route had spanned the altitudes of the Rockies, the windswept mid-American plains and the severe ups and downs of the Poconos before he hit the mean streets of Manhattan.

He ran at a consistent nine minutes per mile, occasionally walking up hills or slowing toward the end of the day to let his muscles cool down.

Kostelnick said he passed the time by thinking about sports and numbers.

“I would run 72 miles a day. So I’d break it up into 18 holes of golf, and every four miles was another hole,” he told a Post reporter who ran with him his first five days and then his final three.