The men, including five Saudis, had been accused of plotting to carry out attacks to avenge the CIA's killing in Yemen of a top al-Qaeda operative in 2002 with the help of a drone.
Prosecutors had said the 19 travelled to Iraq and then returned to Yemen to carry out their "mission" on the orders of Abu Musab al-Zarqawi, the al-Qaeda leader in Iraq who was killed in a US air raid a month ago.
"The court decided to acquit the accused due to lack of evidence," the judge said.
Yemen, the ancestral home of Osama bin Laden, the Saudi-born al Qaeda leader, joined the US-led war on terrorism after the September 11 attacks on the United States in 2001.
The country has cracked down on al-Qaeda-linked fighters and groups following attacks at home, including the bombing in 2000 of the US warship Cole and an attack in 2002 on the French supertanker Limburg.