PORTLAND, Maine — Long before she was a judge on “American Idol,” before she’d written songs that would appear on albums that sold tens of millions of copies, before she’d worked with Britney Spears and Pink and Celine Dion, Kara Dioguardi nearly quit the music business. She’d taken a year off to pursue songwriting and producing after having had some success in those fields abroad, but that year brought only frustration.

At that low point someone had given Dioguardi the phone number of a manager and she’d called him, but hadn’t heard back. She set a deadline: if he didn’t contact her by midnight, she was quitting music and going back to a job she’d once held in sales.

“I cannot believe it, but about five minutes before twelve o’clock that night the guy called,” she says. “He was, like, we need you tomorrow in L.A.” That call led her to a producer who led her to a new project—writing songs for Enrique Iglesias. She was on her way.

RELATED: Former American Idol Judge Kara DioGuardi

Dioguardi, who lives in York, tries to repay her good fortune through the nonprofit she created called Inspired Nation. On October 15 at Ogunquit Playhouse, it will hold an annual fundraiser, a talent competition for singers ages 12 to 21 from all over New England. Dioguardi will be one of the judges at the event, which is called New England Sings. The winners receive prizes that enable them to travel and study music. It’s part of the mission of Inspired Nation, which is straightforward. “It’s to inspire and bring together young people through music,” Dioguardi says, “ and to give them a platform to voice their truth, their story.”