Additional Chief Judicial Magistrate-I Ajmer Khagendra Sharma announced the decision after the ATS approached the court to conduct the test on Saturday, May 1, a senior ATS official said in a news agency report.
Gupta will be taken to Hyderabad by an ATS team for the test.
Gupta, suspected of having links with Hindu group Abhinav Bharat Sangathan, was arrested on Friday, Apr 30, when he was visiting his sick mother.
Officials are investigating his links with Sadhvi Pragya Singh Thakur, a prime accused in the Malegaon blast case.
Two more suspects, Chandrasekhar and Vishnu Patidar, were arrested by the ATS in two seperate incidents.