A federal judge has dismissed a lawsuit filed by the father of a Muslim boy who was arrested after taking a homemade clock to his high school in Texas.

Mohamed Elhassan Mohamed sued the city of Irving, the Irving Independent School District and the principal of MacArthur High School on behalf of his son Ahmed Mohamed, whose arrest and three-day suspension for taking a clock — mistaken by a teacher for a bomb — to school on Sept. 14, 2015, attracted national headlines.

Charges later were dropped, but Mohamed filed a lawsuit claiming his son’s civil rights were violated by discrimination on the basis of his race and religion. The suit, which sought unspecified damages and attorney fees, also claimed city officials violated the then-14-year-old boy’s rights under the Fourth and Fifth amendments during his interrogation and arrest.

In a 37-page filing dated Thursday, US District Judge Sam A. Lindsay said he disagreed.

“First, other than wholesale conclusory and speculative statements, Plaintiff does not allege any facts from which this court can reasonably infer that any IISD employee intentionally discriminated against A.M. based on his race or religion,” Lindsay wrote.

Attorneys for the teen said in November that he deserved $15 million — $10 million from the city of Irving and another $5 million from the city’s school district. The boy’s family has since moved to Qatar after accepting a foundation’s offer to pay for his education there, the Associated Press reported.

Ahmed may file an amended complaint by June 1, Lindsay wrote.

Later Friday, the city of Irving released a statement saying it was “pleased with the federal court’s ruling to dismiss the Mohamed lawsuit against the city.” Noting that the case might not be over yet, the city added that it would “vigorously continue to defend itself, its officers and the justifiable actions taken in this matter in ensuring the safety of schoolchildren and the public.”

In a statement to The Post, attorneys for the school district and principal Dan Cummings said Thursday’s ruling shows that the court recognizes the “challenging situations” faced by public school officials.

“Schools and principals must make decisions every day regarding student safety,” the statement read. “The opinion confirms that there was no suggestion of discriminatory intent by any school district employee.”

Thursday’s filing was first reported by the Daily Mail.