OUTSPOKEN former Alaska governor Sarah Palin has taken aim at the boy arrested and suspended for taking a homemade clock to school, saying the school was justified for thinking it could have been a bomb.

Year nine student and aspiring engineer Ahmed Mohamed became the most talked-about kid in America this week after he was arrested at his Texas school for bringing in a clock he’d built by himself.

While charges against Ahmed have been dropped, his arrest drew the attention of Facebook founder Mark Zuckerberg, NASA engineers and even US President Barack Obama, who invited the youngster to the White House.

Cool clock, Ahmed. Want to bring it to the White House? We should inspire more kids like you to like science. It's what makes America great. — President Obama (@POTUS) September 16, 2015

As the #IstandwithAhmed hashtag trended on social media, many commentators also slammed the school’s response as racial profiling at its worst, as Ahmed — who said he innocently brought the clock to class to impress his teacher — was Muslim.

In a rant on Facebook, Ms Palin said Ahmed’s arrest was completely reasonable and school officials were justified for thinking the device, make out of a pencil box, was an explosive.

“Yep, believing that’s a clock in a school pencil box is like believing Barack Obama is ruling over the most transparent administration in history,” she wrote, also sharing pictures of her kids’ pencil boxes.

“Right. That’s a clock, and I’m the Queen of England.”

Ms Palin also criticised Mr Obama for inviting Ahmed to the White House, accusing him of trying to be a “cool saviour”.

“President Obama’s practice of jumping in cases prematurely to interject himself as the cool savior, wanting so badly to attach himself to the issue-of-the-day, got old years ago,” she said.

She continued: “Friends, consider the kids disciplined and/or kicked out of school for bringing squirt guns to school or taking bites out of a pop tart until it resembled (to some politically correct yahoo) a gun.

“Or the student out deer hunting with his dad early one morning who forgot he had a box of ammo in his truck when he parked in the school’s lot later that day. Kids humiliated and intimidated for innocent actions like those real examples are often marked the rest of their lives and made to feel really rotten.

I expect they will have more to say tomorrow, but Ahmed's sister asked me to share this photo. A NASA shirt! pic.twitter.com/nR4gt992gB — Anil Dash (@anildash) September 16, 2015

“Whereas Ahmed Muhammad (sic), an evidently obstinate-answering student bringing in a homemade ‘clock’ that obviously could be seen by conscientious teachers as a dangerous wired-up bomb-looking contraption (teachers who are told ‘if you see something, say something!’) gets invited to the White House.”

But it could be Ahmed who has the last laugh, as the incident also scored him an invitation to visit his “dream school”, the prestigious Massachusetts Institute of Technology.

.@anildash @IStandWithAhmed we would love to have Ahmed visit us at MIT! — Chanda (王嬋娟) (@IBJIYONGI) September 16, 2015

Ahmed said he spent his spare time creating his own inventions and has even built his own Bluetooth headphones.

He also revealed plans to part ways with his current school, MacArthur High School in Irving, Dallas County, during a press conference on Thursday.

“Thank you to all my supporters on Twitter, Facebook, all social media,” he said.

“Don’t let people change who you are, even if you get a consequence for it. You need to show them your talent.”