In the Oct. 25 episode of the new hit ABC drama “Quantico,” the show’s FBI recruits take on undercover personas. While interrogated about her made-up back story, one character answers that her prom date was a guy named David Oneal.

It’s a throwaway line for the average viewer, but a meaningful inclusion for star Jake McLaughlin — who wrote the name into the show as a shoutout to one of his best friends, with whom he served in Iraq.

McLaughlin, 33, brings a military past to his “Quantico” role as ex-Marine Ryan Booth, who arrives at FBI training with an undercover mission. As a member of the US Army’s 3rd Infantry Division, McLaughlin himself was on the ground for the March 2003 invasion of Baghdad, where his unit was tasked with taking over strongholds of three key highway interchanges — known as objectives Larry, Moe and Curly — to allow US forces to remain in the city center.

“It was constant battle, constant firefights day-in and day-out,” McLaughlin, who enlisted after 9/11, tells The Post.

The year-long deployment left the Paradise, Calif., native with knee problems (incurred during an apartment raid in Fallujah), shrapnel scars on the back of his head from a rocket-propelled grenade (RPG) attack in Fallujah and residual issues from a back injury sustained jumping through a blown-out wall to dodge an RPG explosion during his first week in Baghdad.

“The RPG came within a foot of my back. I dropped down 6 to 7 feet, and when I landed with my [machine gun] in my hand, I twisted,” McLaughlin recalls. He was left with a herniated L5 vertebra and a bulging disc.

“We got the guys that [fired] it,” he adds.

McLaughlin was fine for the rest of deployment — it wasn’t until he got back to base in Fort Stewart, Ga., that his legs started to go numb on the 6- to 12-mile road marches carrying a 75-pound load. As he recounted to the Los Angles Times in 2007, the back injury went untreated for a year while he waited for an appointment with a Veterans Affairs doctor. He also talked of experiencing mild post-traumatic stress disorder shortly after he returned, panicking when hearing a routine cannon blast from the base because he wasn’t carrying a weapon.

“When you’re over there, you’re surrounded by a lot of bad stuff — mostly death,” McLaughlin told the Los Angeles Times. “It just kind of gives you a different outlook on life. How quickly it can be taken away from you.”

While he dreamed of being an actor before enlisting (at 18, he took a job as a security guard at Universal Studios, hoping to catch a break), McLaughlin didn’t get his first role until he returned from Iraq, when director Paul Haggis was looking for veterans for his 2007 film “In the Valley of Elah” and cast him as Specialist Gordon Bonner, the roommate of Tommy Lee Jones’ missing soldier son.

After shooting the movie, McLaughlin moved back to Los Angeles for a year to fill out his résumé with small TV guest spots while working construction. “There were times when I’d go to lawyer auditions and everyone’s in a suit and I’m covered in concrete and paint,” he recalls.

His military past has also armed him with practical skills for an action role like “Quantico” (“weapons training, how to clear a room, all that stuff is imprinted into me”) as well as the stamina for long days on the set away from his family.

“We’re [filming] in Montreal and I live in northern California with my wife [Stephanie, a stay-at-home mom] and kids [two daughters, ages 13 and 1, and a 9-year-old son],” he says. “When I go on jobs like this, we look at them as deployments.”