Joshua James Baker was arrested for allegedly carrying 36 grams of marijuana mixed with tobacco and 37 diazepam pills - Representational Image Pedro Pardo/ AFP

An Australian man detained in the Indonesian island of Bali for allegedly carrying 36 grams of marijuana mixed with tobacco and 37 diazepam pills has been rearrested after he reportedly escaped from police custody.

Joshua James Baker, 32, from Queensland, was detained on Sunday afternoon (8 October) by Ngurah Rai International Airport Custom and Excise personnel upon his arrival at the airport from the Thai capital Bangkok.

Baker was handed over to the Bali police headquarters the day after his detention and taken to Bhayangkara Hospital for medical tests.

While he was at the hospital, Baker escaped through the toilet ventilation at night, police said.

He was rearrested 10 hours later after police caught him at a luxury hotel in Canggu beach area in North Kuta in Bali.

"He was caught while having lunch at the restaurant in the hotel," Deputy Director of Narcotic Directorate at Bali Police, Adj Sr Comr Sudjarwoko told a press conference on Wednesday.

According to Ngurah Rai Customs and Excise chief Budi Harjanto, Baker was detained after a plastic bag allegedly containing the drugs was found in his luggage.

Harjanto said Baker "went through the customs like other passengers". "We felt suspicious when his luggage passed through the custom's X-Ray," he said. When the police checked, they allegedly found the drugs inside his bag, the Jakarta Post reported.

Baker has been kept for questioning and the police are yet to name him as a suspect.

"In narcotics cases, we have 3x24 hours to collect evidence, which could be extended for another 3x24 hours. Until now, we haven't named him as a suspect as the investigation is still ongoing," Sudjarwoko added.

Indonesia has strong anti-drugs laws, with jail terms for possessing even a small amount of marijuana.