Allen Gregory, the title character of the animated Fox comedy that premieres tonight at 8:30, is a pretentious, intellectual 7-year-old who claims to have won a Tony award, drinks Pinot Grigio with lunch, and has a Warhol painting of himself hanging above his bed.

Considering that he’s voiced by actor and show co-creator Jonah Hill, who has appeared as the chubby, unkempt sidekick in many funny films, it would seem obvious that character and actor couldn’t be more different.

But the personalities of the two are not as different as they seem, at least in terms of sheer ambition.

“When I was six or seven, my parents asked me what I wanted to do, and I said that I wanted to live in Springfield where the Simpsons live,” Hill tells the Post. “And they said, ‘That’s not possible. It’s a cartoon. There are people who draw Homer, who do his voice, and who write what he says.’ And I said, ‘That’s what I wanna do. I wanna write what Homer says.’ ”

Since then, the 27-year-old LA native went in a different, if highly related, direction. co-starring in some of the top comedies of recent years including “The 40-Year-Old Virgin,” “Superbad,” and “Get Him to the Greek.”

So when Fox asked him about possibly doing some animation voice work, he seized the day. He collaborated with actor-writer friends Jarrad Paul and Andrew Mogel (screenwriters of Jim Carrey’s “Yes Man”), and took a month writing the pilot script for “Allen Gregory.”

“We thought, what character could I play in animation that I couldn’t play in real life?” he says. “And we thought, a little kid. Then, we like writing delusional, arrogant characters, and making fun of pretentious people, which we find a lot in our business. So we thought it would be funny if he was the cutest-looking kid, but he was so pretentious.”

Several aspects of the show made Fox executives nervous, including Allen’s tendency to trash his father’s life partner, Jeremy, and his bizarre, flirtatious relationship with his school principal, who’s in her eighties.

In his career, Hill has had a slew of powerful mentors, including Seth Rogen, Sacha Baron Cohen, Brad Pitt, and producers Judd Apatow, and Michael De Luca.

All of them, he says, taught him the same lesson.

“Don’t ever stop fighting against what you don’t want to do,” he says. “If you believe in something, don’t let anyone give you a note that’s gonna make your product worse. All those people I named, that’s why their movies are good — because they don’t change what they believe in. I never did that once on this show and it caused a lot of arguments, but the show is exactly what I want it to be. I was like, we do this, or there’s no show.”

As diva-esque as that sounds, Hill stresses that Fox is the show’s natural home.

“I love the people I work with, but [Fox] is in an interesting position,” he says. “They knew they wanted to be really edgy, because that’s what works with [shows like] ‘Family Guy.’ But then they get scared to actually do it. They’re intelligent and have great ideas, but they work for this massive corporation.”

Hill’s ability to stand up for his work is just one trait that makes him a natural leader, says showrunner David A. Goodman (“Family Guy”).

“The thing about TV is that it’s gotta be a collaboration, and Jonah is an amazing collaborator,” says Goodman. “He’s learned how to not only pitch the best ideas, but hear them. He’s always about what works best, and it doesn’t have to be his idea — although it often is.”

Hill’s behind-the-scenes evolution is just one of several he’s currently enjoying. While he’s co-starred in many of the more successful comedies of the past few years, his latest role, opposite Pitt in “Moneyball,” has propelled him into the realm of actors who can work in both comedy and drama.

“‘Moneyball’ did everything it could possibly have done, because every director I know has seen it. It gave me respect as a dramatic actor,” he says.

Hill helped his cause with his recent dramatic weight loss, as he’s dropped around 40 pounds off his “Moneyball” frame.

“I just decided that I needed to make a change,” he says. “I have such discipline in my work, my friendships and my life, but I didn’t know about nutrition. So I was like, it’s time to grow up. I saw a nutritionist and just worked at it really hard for a few months, eating right and exercising, and I feel great. I don’t feel I have anything I’m not in control of.”

This discipline may be credited in part to Hill having grown up in LA, the son of a rock and roll accountant whose clients included Guns N’ Roses. As such, he’s unimpressed by notions of celebrity and fame.

“Growing up around show business people made me want to be in show business less, because I don’t think these people are cool,” he says. “I’m way more impressed when I meet a production designer, or director, or a painter. I know people who grew up in the middle of nowhere and want to be an actor, and they’re like, ‘Oh my god, they’re incredible people.’ But when you grow up around them, you’re like, ‘They’re just normal people.’”

The people may be normal, but Hill recognizes that his situation is anything but. As his opportunities increase — he serves as producer on two upcoming films, “The Sitter,” and “21 Jump Street” — he plans to meet their challenges.

“You look at Judd’s career, and he had a moment after ‘The 40-Year-Old Virgin,’ and he capitalized on it for the next eight years by working really hard,” says Hill.

“So when I had my opportunity, I just tried to make smart choices and work as hard as I possibly could. I’ll rest when I’m an old man.”