Judge Emmanuel Amadi said they were all guilty of treason but had leave to appeal within 30 days.
A correspondent in court told the BBC that relatives broke down in tears as the judgement was read out.
It is not the first time army officers have been accused of plotting against President Yahya Jammeh.
Mr Jammeh seized power in 1994 as a young army lieutenant and has won three widely criticised multiparty elections since then.
The men were accused of procuring arms, ammunitions, equipment and mercenaries from Guinea to stage a coup.
"After going through the evidence of the prosecution and the defence, I find all the persons guilty and accordingly sentence them to death on all three counts," Judge Emmanuel Amadi is quoted as saying by the AFP news agency.
Fabakary Ceesay from Gambia's Foroyaa newspaper told the BBC the alleged plotters were in court for sentencing.
They included former army chief Langtombong Tamba, former intelligence chief Lamin Bo Badjie and former deputy chief of police Modou Gaye.
Mr Ceesay says the men tried to comfort their relatives who began wailing as the verdict was announced.
According to AFP, the last time someone was executed in The Gambia was in 2007.
Several people were sentenced to long prison terms over the 2006 coup attempt.
A Gambian judge has sentenced eight men, including a former army chief, to death for their part in an alleged coup plot last year.