It set the stage for diplomatic retaliation by France after executions of other foreigners strained relations with Australia and Brazil.
The administrative court in Jakarta said it did not have judicial authority to overturn a presidential rejection of clemency for Serge Atlaoui.
His case has drawn attention in France, which vigorously opposes the death penalty.
Indonesia, which is predominantly Muslim, takes a hardline stance against drug crimes and resumed executions in 2013.
So far this year it has executed 14 people, mostly foreigners, convicted in drug cases.
Officials justify the death penalty by pointing to the estimated 18,000 young Indonesians who die each year from drug use.
Presiding judge Ujang Abdullah said the court has no capacity to rule on the case since granting clemency is the prerogative right of the president.
“The president’s right to grant clemency is granted by the constitution while the authority of the administrative court is just to judge on decrees issued by administrative officials,” Mr Abdullah said.
Lawyers for Atlaoui, 51, made the last-ditch appeal which had little chance of success after president Joko “Jokowi” Widodo denied clemency in December.
Prosecutors dismissed the legal manoeuvring as only an effort to buy time but did not try to block the appeal. Officials have been at pains to show Atlaoui was not denied any of his rights under Indonesian law after France’s foreign minister Laurent Fabius condemned the handling of his case.
Mr Fabius said the French government is opposed to the death penalty “in all places and under all circumstances”.
He said France is “totally mobilised” in support of Atlaoui.
French president François Hollande has warned of diplomatic consequences and possible economic fallout if Atlaoui is executed.
The Frenchman was arrested in 2005 for involvement in an ecstasy factory on the outskirts of Jakarta.
A court found him guilty in 2007 of trafficking 551lb of hallucinogens and 306lb of methamphetamines.
His lawyers say he was employed as a welder at the factory and did not understand what the chemicals on the premises were used for.
“From the beginning of this case, we know and believe that our client is innocent,” said lawyer Nancy Yuliana. She said the legal fight will continue even though the court said all legal options are exhausted.
The lawyer added: “But I can’t say what we would do next. We will discuss it with our client, his family and the French Embassy.”
A spokesman for the attorney general’s office said the execution would happen after the holy month of Ramadan, which ends on 17 July in Indonesia.
He added: “We welcome the Jakarta Administrative Court’s decision rejecting Atlaoui’s last appeal.”
In April, Indonesia executed eight people convicted of drug trafficking, straining relations with Australia and Brazil, whose citizens were among those shot by a firing squad.