“If that’s how it is, I have hopes for it,” Dr. Habib said. “It will change the narrative and it will maybe open the floodgates for more shows like this about Muslims.”

The Ramy of the show has to reconcile his faith with the demands of being a young adult in New Jersey. He said that while his character on the show wasn’t an exact replica of himself, “a lot of the rules that are in the show are kind of the ones that I do have for myself personally.” Most of his love interests early in the season are white and do not understand why he doesn’t drink or do drugs. He has deep conversations at his mosque about how to properly wash his feet and what his place is in the world. (Youssef doesn’t completely avoid caricatures in the show: His uncle, played by Laith Nakli, is cartoonishly homophobic and anti-Semitic.)

At the same time, “Ramy” explores many of the same issues as other contemporary shows about young adults trying to get by, like HBO’s “Girls” and “Insecure.” Along with the push-and-pull of his faith, Ramy contends with meddling relatives, selfish friends, dating woes and career struggles.

“I do believe in God,” Youssef said. “I realized that there was this void in entertainment of someone talking about that genuine construct. I have a bit about it I do all the time about how there’s Friday prayers, and then there’s Friday night, where it’s like: ‘No, I want to do both. I want to pray, and then, I also go out, and I have a girlfriend.’”