Maggie Rogers grew up on the rural Eastern Shore of Maryland playing banjo and immersing herself in folk music and the outdoors. But on a trip abroad to France as a New York University student, she experienced spiritual transformation in dance music.

In early March, she was among a small number of music students at the Clive Davis Institute within NYU’s Tisch School of the Arts to participate in a master class with Grammy Award-winning producer Pharrell Williams.

During a listening session, Rogers was the last student to showcase an example of her work, a new song, still unfinished, called “Alaska.” A video capturing the moment has become an Internet sensation, attracting more than 1 million views on YouTube, and overnight has made Rogers, 22, a newfound star.

From the second the track starts, it’s clear Williams is stunned by Rogers’s ethereal voice, the rhythmic thump of the bass and crystalline melody.

He bobs his head and taps his feet to the beat. When the song ends, he’s nearly speechless, saying to her simply, “Wow.”

Williams spent 2015 as an artist in residence at NYU. As a producer first with the Neptunes and later on his own, Williams has worked with superstars such as Justin Timberlake, Britney Spears and Jay Z. A broadly respected musical talent, he provided his magic touch to Daft Punk’s “Get Lucky” and Robin Thicke’s “Blurred Lines,” and created the sonically infectious 2014 pop hit “Happy.”

Williams immediately compares Rogers’s songwriting abilities to Stevie Wonder.

“I’ve never heard anyone like you before,” Williams tells her in the video. “I’ve never heard anything like that.”

Williams tells her that the song affected him like a drug.

“Thank you,” Rogers says.

“No, thank you, seriously,” Williams replies.

A representative for Williams declined to comment. Rogers declined an interview with The Post.

Rogers, a 2016 NYU graduate with a double major in English and music, said during the video that she’s going to focus on putting the finishing touches on “Alaska.”