John David Washington plays an undercover officer in “BlacKkKlansman.” (Focus Features)

John David Washington, the star of Spike Lee’s new film “BlacKkKlansman,” began working with the director long before he even knew he wanted to be an actor — two decades before, in fact.

When Washington was 7 years old, he visited his father — a burgeoning leading man named Denzel — on the set of Lee’s 1992 biopic “Malcolm X.” Lee happened to be filming a climactic scene in which elementary school students rise, one by one, and declare, “I am Malcolm X.”

“My mom asked if I wanted to be one of the kids,” Washington recalls. “I was like, ‘Heck, yeah, I want to do it.’ I was told to listen to Uncle Spike: ‘You’re going to get up and you’re going to say these words.’ I did it seven times and we got it — I think I nailed it.”

Twenty-three years passed before Washington would act on screen again. Although he harbored an appreciation for the acting craft, calling it his “secret love,” Hollywood stardom didn’t appeal to him.

“Because of who I was related to, I guess I saw what success looked like,” he says. “I just liked the stuff [my father] was doing before all of the noise.”

So Washington carved out a different path, starring as a running back at Morehouse College before spending five years in NFL Europe and the United Football League. When a torn Achilles tendon put an end to his athletic aspirations, he decided to follow in his father’s footsteps after all. In 2015, he reintroduced himself as hotheaded NFL star Ricky Jerret on the HBO series “Ballers.”

Now, Washington has reunited with Uncle Spike to take on the lead role in “BlacKkKlansman.” The 34-year-old plays Ron Stallworth, an undercover Colorado Springs police officer who infiltrated the Ku Klux Klan in the late 1970s. As the movie’s opening text helpfully clarifies, yes, “Dis joint is based upon some fo’ real, fo’ real s—.”

“Nobody knew about this story,” Washington says. “You have an opportunity to share a piece of history in a country where I was born in, in this medium, and to do it the way Spike did it? That’s why I do this.”

Lee uses “BlacKkKlansman” to deconstruct various shades of bigotry, all of which are deeply disturbing in their own way. Washington’s Stallworth confronts systemic racism within the local police department. An undercover officer played by Adam Driver must grapple with blatant displays of anti-Semitism thrown his way. And KKK leader David Duke (Topher Grace) represents a more organized, buttoned-up brand of intolerance.

The film ultimately positions itself as an interrogation of America’s racial politics, drawing not-so-subtle parallels between white supremacism of decades ago and the current alt-right movement.

“This has been a problem for a long time and continues to be,” Washington says. Gesturing toward the movie’s poster, which features the tag line “Infiltrate hate,” he adds, “When I say, ‘This is a problem,’ I’m talking about that word right there: hate. Hate is a problem.”

Telling such a resonant story helped Washington put his unexpected career pivot in perspective. “I just was scared,” he says of giving up one dream to pursue another. “But I just closed my eyes and jumped.”

Having landed back in Lee’s filmography, a quarter-century after “Malcolm X,” those fears have faded.

“This is the pinnacle, here,” Washington says. “Now I’m hooked — I’m a fiend for it now.”