Sophia Anne Caruso, the talented young star of “Beetlejuice,” surprised a lot of the musical’s fans when she announced on Instagram last week that she’d performed her last show.

Actors rarely leave a Broadway run abruptly, and when they do leave, they usually give their final performance on a Sunday, not in the middle of the week.

But tension had been building among Caruso and her producers and co-stars. Production sources say that she’d been missing performances. When she did show up, a source says, her behavior was “eccentric” and “erratic.” Alex Brightman, who plays the title character, was especially annoyed at her “lack of discipline,” another source says. “She and Alex did not get along at all. But the whole cast was getting fed up. Everybody was relieved to see her go.”

Several sources say that the producers decided to let the 18-year-old “frame her departure whatever way she wanted to,” which resulted in her Feb. 21 Instagram post.

Caruso’s press agent, Carleen Donovan, says the actress “exercised her contractual out to pursue television work and was not fired from the show.”

In an email to the cast last week, the show’s producers wrote, “After several conversations, [Caruso] has decided . . . to pursue television work. Please join [us] in wishing her all the best.”

Presley Ryan, Caruso’s understudy, has taken over the role of the morbid teenage Lydia. “She’s friendly, talented and dependable,” a source says. “It will be a nice change.”

Caruso appeared on Broadway in “Blackbird” with Michelle Williams and Jeff Daniels and won praise for her performances in off-Broadway’s “The Nether” and “Lazarus.” At 9, she played Helen Keller in a Seattle production of “The Miracle Worker.” She told The Post’s Barbara Hoffman last year that she changed her blocking every night in Seattle, throwing off the other actors. “Just trying to keep it fresh!”

She’s up for a Clive Barnes Award for her performance in “Beetlejuice,” for which she’s already won a Theatre World Award. I’m emceeing the April 6 ceremony. It will be fun to see if she shows up. In the meantime, she might keep in mind the advice the great Cherry Jones gave the nominees a few years ago: “Be prepared. Be prompt. And be polite.”

“Beetlejuice” is scheduled to close at the Winter Garden in June after falling below its stop clause, allowing the Shuberts to give the theater to “The Music Man,” starring Hugh Jackman. But “Beetlejuice” has since caught on, its weekly grosses climbing to over $1 million. So the Shuberts have found it another home: the Ethel Barrymore, soon to be vacant after the collapse of “The Inheritance.”

“Beetlejuice” producers are madly crunching numbers to see if they can make the move work. They were planning on scaling the production back for the national tour, so they may well put a slimmed-down “Beetlejuice” in the Barrymore this summer, then decide if it stays on Broadway or hits the road. Stay tuned.

Eighteen thousand school kids cheered “To Kill a Mockingbird” this week at Madison Square Garden. It was the first time a Broadway show has played the Garden, and it was so successful, producers Scott Rudin and Barry Diller are planning to do it again.

Spike Lee hosted the event, urging the kids to “dream big” and “to listen closely to the words of the play.” And they did. During the play’s dramatic moments, nary a peep was heard.

At a dinner after the show, a veteran MSG staffer praised star Ed Harris. “In all my years at the Garden, I’ve seen the greatest rock stars perform there,” he said. “Some can genuinely command the space. Others can’t. Ed Harris is Springsteen.”

“Len Berman and Michael Riedel in the Morning” airs weekdays on WOR Radio 710.