Alan Yang knows desperation. “Early last year, things were bad. I thought I might take the LSATs,” says the screenwriter, with a shudder, referring to the Law School Admission Test. “I even got on the website and was ready to register.” 

Instead, Yang deftly avoided a life in law by nabbing a staff writer slot on NBC’s “Parks and Recreation.” Previously, he had written for Carson Daly’s latenight show and consulted on “South Park.”

As the gig didn’t start for six months, he focused on a spec screenplay, “Gay Dude” — a “Superbad”-like comedy about two high school seniors on the prowl for a one-night stand — that became a favorite among executives around town.

And what a difference a hot screenplay makes. Shortly afterward, he signed on to rewrite “Boss Go Home” for Warner Bros. and his pitch for comedy “White Dad” sold to Sony. 

“The script is very audacious in its conception,” says Sony exec VP Elizabeth Cantillon about Yang’s story of a white man who adopts the son of his African-American girlfriend after she dies suddenly. “He views race in a different way, and he isn’t afraid of challenging people’s ideas in a fresh and funny way.” 

Yang, who majored in biology at Harvard until he started writing for the college’s legendary humor magazine, says, “I named my corporation Adjective Noun because the first two things I wrote are ‘Gay Dude’ and ‘White Dad.’ I want to be funny in a way that is super relatable. I like grounded, character-based comedy, but I also like offensive things.

These days, he divides his time between punching up jokes and breaking stories.

“I like the social nature of the TV writers’ room, but I think I’m more attuned to feature screenwriting because I can go to a park and sit on a bench and write for a few hours,” Yang says. 

And that near career-swerve from comedy writer to attorney still spurs him on.

“To do something really good, you have to fully commit and have no other options,” he says. “Being motivated and working your ass off helps too.”

AGE: 27 

HOMETOWN: Riverside, Calif.

INSPIRED BY: “All the recent Judd Apatow movies. ‘Rushmore’ is one of my favorite movies as far as showing real characters who are interesting and evolve. As for TV, the holy trinity has always been ‘The Simpsons,’ ‘Seinfield’ and ‘Saturday Night Live.’ ” 

UP NEXT: “White Dad,” a comedy in active development at Sony with Bob Simonds producing

REPS: Agent: Mike Esola (WME); attorney: Jeff Frankel (McKuin Frankel Whitehead)