How do you discover your inner goofball?

For Will Ferrell, the eu­reka moment came relatively late, years after the other boys had learned the joys of disrupting class. He was a high school senior, a conscientious student and a jock (basketball captain, baseball player, kicker on the football team), much too popular and well adjusted to crave class-clown validation. But then a friend asked him and a buddy to work up some shtick for the morning P.A. announcements to help sell Class of ’85 T-shirts.

“They were like old radio skits,” recalls Ferrell, brightening at the memory. “We’d do voices, like the old Irish Spring commercials.” Here Ferrell adopts an Irish brogue: ‘You smell like a bucket of vomit. Why don’t you wear this — your senior-class T-shirt!’”

Ferrell loved it. More important, the other kids loved it. Even the teachers at University High in Irvine, Calif., in the heart of Orange County, started egging him on. Ferrell started staying up late to write more bits, skipping his homework. He and his friend started performing sketches from “SCTV” at school assemblies. More hilarity, more praise ensued.

You already know where this leads. A few years later, post-college, Ferrell has become a member of the Groundlings improv group in L.A. He gets a tryout with Lorne Michaels and “Saturday Night Live” — and kills. About 6,000 distinctive Ferrell characters and bits follow: Harry Caray, Craig the Cheerleader, James Lipton, Alex Trebek, George W. Bush, More Cowbell. With his “SNL” co-writer (and now collaborator/business partner) Adam McKay, Ferrell goes on to make movies, including their absurdist masterpiece, “Anchorman: The Legend of Ron Burgundy.” They also write a Tony-nominated Broadway show with Ferrell as Bush, “You’re Welcome, America,” and start a comedy Web site, Funny or Die. Which kills, too, thanks notably to “The Landlord,” a short video starring Ferrell and McKay’s 2-year-old daughter, Pearl.

Not incidentally, it all leads to Ferrell’s selection as the recipient of the 2011 Mark Twain Prize for American Humor. The Kennedy Center will hand the award to Ferrell on Sunday night in one of those made-for-TV gala-specials (it will air on PBS stations on Oct. 31), putting Ferrell’s name alongside such former winners and comedy legends as Richard Pryor, Bill Cosby, George Carlin, Neil Simon and Carl Reiner. Pretty sweet. Or as Ferrell-as-Lipton might say, “Scrumtrulescent!”

Stay classy, Will Ferrell

At 44, Ferrell’s still on the young side to be joining comedy’s Hall of Elders (on the other hand, Tina Fey, Ferrell’s former “SNL” running mate, was just 40 when she received the same honor last year). But it’s hard to dispute Ferrell’s gifts as a comic actor and writer.

As McKay points out, Ferrell has played the full range, from subtle to slapstick to utterly bombastic. He’s been the damaged man-child (“Elf,” “Step Brothers”), the aggressive dope (“Old School,” “Wedding Crashers”), the pompous and oblivious alpha male (“Anchorman,” Bush). McKay and Ferrell have started working on “Dog Fight,” a satire in which Ferrell plays a Southern politician running against a candidate played by Zach Galifianakis. “Will doesn’t want a formula,” McKay says. “He’s actively looking to screw with his own formula for success.”

If that weren’t enough, Michaels, who’s been managing star egos like a lion tamer for decades, says Ferrell is that rare comedic commodity: a low-maintenance mensch. “People adored working with him” at “SNL,” says Michaels, himself a Twain recipient. “He was never funny at someone’s expense. There’s not a trace element of cruelty or meanness in Will.”

On this day in mid-October, Ferrell seems as sunny and mellow as the 90-degree heat warming Southern California. He’s unshaven, and pads around his office, a restored 1920s-era building off Melrose Avenue, in cargo shorts, Adidas and a USC T-shirt, which is approximately the same attire of the young staff bouncing around the corridors.

Ferrell and McKay decided to call their company Gary Sanchez Productions, which they tell visitors was the name of their mutual hero, a legendary Paraguayan placekicker who played for the Vikings and Chiefs in the NFL. It’s a goof — they just made the name up — but both men were delighted when a Hollywood trade paper printed their bogus story straight up.

Cracking smiles

The antic spirit born in Ferrell’s senior year of high school was nurtured at USC, a school probably better known for incubating tailbacks than comedy stars. Ferrell built on his burgeoning interest in comedy by creating humorous skits for his fraternity brothers. He also found a bigger stage with the help of a humanities teacher, the late Ron Gottesman. Midway through one of Gottesman’s lectures, Ferrell would casually wander into class pretending to be a campus handyman.

“Excuse me, what are you doing?” Gottesman would ask, as Ferrell, smoking a cigarette, would start working away with a power drill or a bucket and mop.

“Don’t worry. I won’t be long,” Ferrell would reply breezily. He always made sure to bend over far enough so the class could take in his “plumber’s crack.”

Another bit involved a pal who would incite passersby against Ferrell as he pushed some heavy equipment along a campus walk, his pants slung low enough to display the aforementioned crack. “Look at that guy!” his friend would roar in mock horror. “What does he think he’s doing?” Ferrell would play dumb. The two conspirators would keep up the ruse until they elicited either an angry cacophony or laughter from the crowd, and sometimes both.

“There was something about college that really brought it out,” says Ferrell, a big, fleshy man whose bulk seems to fill his little corner office. “Maybe it was the lure of a bigger audience, the danger of it. I mean, being obnoxious in a small high school class, that’s too easy.”

For crying out loud

Years later, when Michaels was considering casting Ferrell at “SNL” in 1995, Ferrell came to their second meeting with a briefcase, which he rested on his lap and never opened during their conversation. As their meeting concluded, Ferrell picked up the case and began to walk away. Michaels had to ask: What’s in the briefcase? Ferrell popped the locks, revealing stacks of fake cash. He’d planned to mock-bribe Michaels with the money during the interview but aborted the idea when the conversation turned serious.

Ferrell rarely lost his nerve after that. McKay likes to tell of the time Ferrell joined several writers and performers from “SNL” for what became known as “Gentlemen’s Tuesdays.” Each week, the group met to engage in some uplifting cultural activity (“We couldn’t always be drunken scamps,” McKay says). One day, during a visit to the Museum of Modern Art, Ferrell parked himself in front of a painting and began to weep theatrically. He began quietly, but then his wailing echoed throughout the entire gallery. McKay and friends scooted to the other side of the room to watch the horrified and mystified reactions.

At other times, he remembers, Ferrell would attach himself to a group being guided through a museum by a docent. He’d offer his own commentary: “Yeah, right!,” “Oh, give me a break!”

Ferrell’s most absurd bit of theater may have been the joke he played on his own “SNL” colleagues during his third season with the show in 1998. When a sketch called for him to dress as a 1970s trucker, Ferrell donned some old Wrangler jeans, a denim shirt, down vest and a trucker hat, set off with a huge belt buckle. After the skit was over, Ferrell continued to wear the outfit to work . . . every day for the next 31 / 2 months.

“It started to drive people crazy,” he remembers with delight. “People started questioning my sanity. ‘Is he okay?’ Alec Baldwin [hosting the show one week] asked me, ‘Are these your normal clothes? Because you don’t look good in them.’ It really divided people. Some people said, ‘Keep wearing that. It gets funnier every day.’”

Ferrell knows these stories have a common thread: Some people don’t get him. And he’s okay with that. “Adam and I have always been fascinated by that type of humor that hopefully most people think is funny, but if there’s 25 or 30 percent, even 40 percent, that don’t get it, that tickles us almost more than the 60 percent that are laughing really hard. I don’t know what that says about us or me.”

Well, he ventures, maybe it says that comedy isn’t universally understood or appreciated. And if it is, it’s probably not that funny to begin with.

Ron Burgundy, the early years

Ferrell — his given name is John; William is his middle name — grew up in Irvine, the older of two boys (his brother Patrick is three years younger). Ferrell’s father, Lee, was a musician who played with the Righteous Brothers for years and was rarely home during his sons’ formative years. He divorced Ferrell’s mother, Kay, a schoolteacher, when Will was 8, but moved nearby.

Ferrell, his mother and brother lived in an apartment complex called Park West, a place that Ferrell describes as pleasant but one known among his more affluent peers as “Park Watts,” primarily, Ferrell suspects, because it was home to the few minority families in town. Ferrell describes his upbringing as “definitely lower middle class. It’s not that we ever went without, but it was definitely always tight.”

The uncertainty of his early years left Ferrell with a desire for a stable career — anything involving “an office and a briefcase.” He went to USC with the intention of being a TV sports journalist and worked briefly as one for a local cable operation. But in his senior year, after some friends took him to see a Groundlings shows, he knew he was hooked. In time, he was performing sketches with future “SNL” players Cheri Oteri and Chris Kattan.

Despite his comedy stardom, Ferrell, like “SNL” alums Bill Murray, Adam Sandler and Ben Stiller, has branched out into drama, too. The public response has been mixed, though critics have generally liked Ferrell’s work. Ferrell starred as a down-on-his-luck salesman in “Everything Must Go,” which was released in May to favorable reviews but scant ticket sales (maybe, Ferrell says without bitterness, more people would have seen it if it had had “a 3-D element or possibly a precocious animal in sunglasses”). “Stranger Than Fiction,” which Ferrell starred in with Emma Thompson and Dustin Hoffman in 2006, did better at the box office. But another Ferrell drama, “Winter Passing,” in which he played a struggling musician, came and went a few months earlier without much notice at all.

Ferrell shrugs. Whatever.

“The victory for me is getting to do something different,” he says. “The bonus is the nice reviews.”

For years, he says, he harbored enough doubts about his career that he maintained a running joke with his wife, Viveca (with whom he has three young sons): “I’d write down a list of alternative occupations I could do if the mayor of show business called and said, ‘We’re kicking you out of town.’ I’ve always felt like I’ve snuck into a black-tie party with a Sears Sans-a-Belt leisure suit on and no one’s noticed I’m holding a glass of champagne. I was always waiting for someone to notice and say, ‘You’re not supposed to be here.‘”

Not very darn likely to happen now. Besides, how much fun would the party be without him?