This is the latest case to be set aside by the courts under new President William Ruto’s government, where prosecutors have withdrawn cases against some of his allies on the same grounds, drawing criticism from veteran opposition leader Raila Odinga.
Gachagua and several and his co-accused were charged with corruption in July last year. He has denied any wrongdoing.
"The application by Director of Public Prosecutions is hereby granted," Victor Wakumile, a magistrate at the anti-corruption court said in his ruling.
"The accused persons is hereby warned and informed they maybe re-arrested in future should investigators find evidence on similar charges," he added.
Director of Public Prosecutions Noordin Haji asked the court earlier this month to allow the withdrawal of the graft charges against Gachagua citing a lack of evidence. There was no challenge to the prosecutor's request to drop the case.
In a separate ruling in July, a court ordered Gachagua to repay 202 million shillings which it determined were the proceeds of corruption.
At the time, Gachagua said the verdict was intended to undermine his candidacy in the 9 August election on then presidential candidate Ruto's ticket.
On 12 October, Haji issued a request to a magistrate's court to withdraw corruption charges against Aisha Jumwa - the Public Service and Gender Cabinet Secretary who is a close ally of Ruto - for lack of evidence. Jumwa had denied any wrongdoing.
On Wednesday, privately owned news group Citizen reported that Jumwa requested Haji to withdraw a murder case against her, arguing that the evidence does not meet the threshold. She has denied any wrongdoing in the case.
Odinga criticised the withdrawal of cases against unnamed government officials.
"Recent developments in which the Director of Public Prosecutions has moved fast to drop cases against government officials and the willingness of the Judiciary to dance to the tunes of the Executive, point to the fact that as a country, we are flirting with lawlessness," Odinga, who lost to Ruto, said in a statement.
A Judiciary spokesperson could not be reached for comment.
Anti-corruption watchdog Transparency International placed Kenya at 128 out 180 countries in its 2021 rankings, a drop of one place from the previous year.
Reuters, the news and media division of Thomson Reuters, is the world's largest multimedia news provider, reaching billions of people worldwide every day.Go to: https://www.reuters.com/