Papa John’s shares soared close to 10% on Tuesday after the company said it has a new top pizza-slinger who will help the company turn the page on a tumultuous two-year period.

In a surprise move, Papa John’s board of directors named Arby’s president, Rob Lynch, chief executive effective immediately — replacing Steve Ritchie, the long-time exec who took the helm after the pizza delivery company’s founder, John Schnatter, stepped down in a haze of controversy.

In announcing the move, Papa John’s board heralded Lynch as a turnaround maverick who drove new growth at Arby’s for the first time in a decade.

Ritchie, who was given barely two years to clean up the mess at the Louisville, Ky.-based Papa John’s, declined to comment on the change, saying he is “still on the board.”

Ritchie was told earlier this year that Papa John’s second-largest investor, hedge fund Starboard Value, would give him a chance to turn around the company even as it searched for another CEO, Starboard’s chief executive, Jeff Smith, said.

“We felt it was our responsibility to have our eyes open,” Smith said in an interview.

“We decided we need to work with Steve and coach him and we’re thankful for the job he did,” said Smith, who was named chairman of Papa John’s in February following a $200 million investment by Starboard.

Ritchie was named the pizzamaker’s CEO in December 2017 after Schnatter resigned following controversy over his criticisms of the NFL’s handling of its players’ kneeling protests. Schnatter later stepped down as chairman for using racial slurs during a conference call.

As CEO, Ritchie faced customer boycotts, major sponsor revolts, declining sales — and a bitter battle with Schnatter, who accused his former protege of stabbing him in the back during the fallout from his NFL and race remarks.

On Tuesday, Schnatter cheered Ritchie’s removal.

“Under Steve Ritchie’s leadership these past two years, the company was run very poorly.” said Schnatter, the company’s largest shareholder.

“Lynch has proven to be an effective marketing leader,” he said. “I’m hopeful that he can be successful at Papa John’s.”

Schnatter, who has slashed his stake in the pizzamaker from 31% to 16.7%, sued the company for ousting him, but later dropped his complaint earlier this year.

In his lawsuit, he also accused Ritchie of smearing him with untrue accusations of racism in order to save his own job.

It has been a stark turn of events for Ritchie, who started at Papa John’s as a customer service representative 23 years ago — and quickly rose through the ranks under Schnatter.

“Steve had to battle a perception issue that he was part of the founder’s inner circle,” restaurant analyst Mark Kalinowski said. “I think it’s a challenge to put the past behind you when you were part of that past.”

“There’s a huge amount of opportunity,” new Papa John’s CEO Lynch told The Post. “Papa John’s has gone through some tough times,” but “there’s a lot of upside potential.”

Papa John’s closed up 9.5%, to $48.