"Death sentence by hanging," Judge Ladu Armenio told Gatdet in the court in Juba, after he was found guilty of treason and other crimes against the state.
The sentencing comes as peace talks between the government and rebels, taking place in neighbouring Ethiopia, stall amid mutual accusations of military assaults.
Gatdet, a former journalist, was also handed jail sentences totalling 21 years, which he is expected to serve before his execution.
He has insisted he is innocent.
Gatdet had fled to neighbouring Kenya where he had been granted refugee status. He was deported back to South Sudan in November 2016 against international law.
His deportation came after he said he welcomed the UN's sacking of its peacekeeping force commander, a Kenyan general, who had been accused of failing to protect civilians.
The UN refugee agency, UNHCR, said at the time it was "deeply concerned" about the fate of Gatdet and that its efforts to stop his forced return had been ignored.
KEEP UPDATED on the latest news from around the continent by subscribing to our FREE newsletter, Hello Africa.
FOLLOW News24 Africa onTwitterandFacebook.
South Sudan won independence from Sudan in 2011, but a little over two years later its leaders began a fresh civil war pitting President Salva Kiir against his former deputy Riek Machar.
Tens of thousands have been killed in the violence, and nearly four million people - roughly a third of the population - have been forced to flee their homes.
Gatdet's lawyers pulled out of the trial last month, arguing that he should have been released as part of a December peace deal in which government and rebels agreed to release of prisoners of war and political detainees.
Fighting has continued despite the December agreement, the latest in a string of deals since war erupted in December 2013.
The latest round of peace talks began in Ethiopia last week, amid growing international impatience with the warring leaders.
Meetings stalled on Monday when both sides accused the other of attacking their forces.
Ceasefire monitors said Monday they were heading to the flashpoint of Nasir in the far east of the country to investigate the fighting.