MOUNTAIN VIEW — Teacher doesn’t like the homemade contraption you brought to class? Try telling Google co-founder Sergey Brin about it instead.

One week after 14-year-old Ahmed Mohamed was detained for showing his high school teachers in Texas a clock they mistook for a bomb prank, the teenager was getting the VIP treatment in Silicon Valley, meeting with Brin and attending an annual youth science fair at the tech giant’s corporate campus.

Writing that she was was glad the clockmaker “took us up on our invite to attend this year’s event,” Mariette DiChristina, editor of Scientific American and the contest’s chief judge, said in a blog post that “curious young scientists, inventors and builders like him should be encouraged and empowered.”

It was a whirlwind trip for Ahmed, who tweeted he was “Going to Cali!!!” early Sunday morning, made a sightseeing detour through San Francisco, stopped at In-N-Out Burger and spent hours mingling with fellow science-loving teens from around the world who convened Monday at the Googleplex for the science competition.

Winning the contest’s $50,000 grand prize was Connecticut high schooler Olivia Hallisey, who created a new way to detect Ebola. Other finalists won awards for projects that tackled Alzheimer’s Disease, vaccine transportation and clean drinking water.

“Amazing projects and people,” Ahmed tweeted from the Monday night award ceremony shortly before flying back to Texas.

Silicon Valley last week had rallied behind the Muslim ninth-grader from Irving, Tex., while he was still under suspicion from local authorities and on a three-day school suspension for bringing the clock to class.

The student, who was wearing a NASA shirt as police escorted him from school, swiftly became a social media sensation and a folk hero for the maker community, getting shout-outs from President Barack Obama and the CEOs of Facebook, Autodesk and Box, and an internship offer from Twitter. A backlash against the Sudanese-American teen has also ensued, with some — such as conservative talk show host Glenn Beck and Irving’s mayor — defending the school’s caution and others — such as atheist author and biologist Richard Dawkins — criticizing him for showing off a device he merely assembled but did not invent.

“He never stated that he invented the clock. He built the clock,” said family spokeswoman Fatima Tekko, in an interview Tuesday.

As he tries to adjust back to normal life, the teen still has a busy season ahead of him. A return trip to California might happen later, Tekko said, but in the meantime he is traveling to New York to visit Google’s branch office there and meet with United Nations officials.

His father withdrew him from his high school while he was visiting Google , and the teen plans to transfer to a more welcoming school, according to the Dallas Morning News.

His fall plans include attending the White House Astronomy Night on Oct. 19 to join scientists, engineers and possibly the president in stargazing from the South Lawn.

“We think Ahmed will fit right in,” wrote DJ Patil, the White House’s chief data scientist and a former Silicon Valley technologist who hails from Cupertino, in a blog post about the astronomy event.

Patil added: “P.S. — Don’t forget your NASA shirt. I’ll be wearing mine.”

Contact Matt O’Brien at 408-920-5011. Follow him at Twitter.com/Mattoyeah.