In the multi-episode arc, the would-be rapper will play Jason, "the cocky, enigmatic frontman" for No Means Yes, a rock band in the show's fictional setting of Tree Hill, N.C., according to the network.
"Kevin came in and (auditioned) and he did a great job," Mark Schwahn, the creator of One Tree Hill, said.
"He really seemed like a sweet guy and I just felt that he would be great in that."
Schwahn acknowledges "people will say this smells of stunt casting" because of Kevin Federline's "really high public persona right now."
"I have to honestly say he was a good fit for the character," Schwahn said. "I don't know a thing about the kid but he seemed sweet and very sincere about working hard and embracing the opportunity. It's just about being good in the role."
Last year, FedEx guest-starred on an episode of CSI as a young street thug named Cole Tritt. He was also reported to be guesting on Entourage.
For the role on CSI, Federline donned a pig mask - and was a part of the episode that scored CSI an Emmy nomination for outstanding makeup. A legend in the making!
Of course, in 2005, Federline and wife Britney Spears appeared on the UPN reality show, Britney & Kevin: Chaotic, which documented their early relationship.
And Federline is perhaps best known for having made fun of himself, playing a fry cook who dreams of stardom in a Super Bowl ad for Nationwide Insurance.
Meanwhile, Federline's former flame, Shar Jackson, with whom he has two kids, is also doing a guest appearance on a CW show, Everybody Hates Chris, this fall.