The Constitutional Council, which decides on the validity of laws, nonetheless recognised that such testing was not completely accurate, and said results could not be the sole factor in determining a minor's age.
“The person being tested gets the benefit of any doubt,” the court ruled.
The case involved a Guinean migrant, identified as Adama S., who arrived in France in 2016 and claimed to be 15, which entitled him to the care of child social services.
Adama refused to submit to the X-ray tests, which are used to help determine an unaccompanied minor's age and require consent under French law.
The tests, originally developed to determine a child's skeletal maturity, are widely considered to be less accurate with older children.
The next year, a juvenile court in Ain, southwest France, ruled that Adama was an adult and removed him from the welfare services.
The number of unaccompanied migrants arriving in France claiming to be minors rose to some 17,000 in 2018 from 6,000 in 2015, according to the Interior Ministry.
In the absence of legal documents, there are few alternatives to the bone tests for accurately assessing a person's age.
But critics say the practice can be used to deny entry to young migrants who should benefit from France's protection under international law.
“We're extremely disappointed,” said Clementine Bret of the Medecins du Monde (Doctors of the World) aid group, one of the plaintiffs in the case.
“We would have liked to see France honour itself by following the examples of Spanish and English courts,” which have outlawed such testing, Bret said.