Ashmawy was captured in the eastern Libyan city of Derna in late 2018 and transferred by authorities loyal to commander Khalifa Haftar to Egypt in May last year.
He was convicted on several charges including plotting a 2014 attack that killed 22 military guards near the frontier with Libya, and involvement in an attempt to kill a former interior minister in 2013, a military statement said.
Ashmawy led the Sinai-based Ansar Bayt al-Maqdis, Egypt's most active militant group, before it pledged allegiance to Islamic State in 2014, it said.
The other 36 defendants tried with him were also convicted of terrorism charges, the court ruled.
Their cases were referred to the Grand Mufti, Egypt's highest Islamic legal official. Egyptian law requires any capital sentence to be referred to him for an opinion before executions can take place.
The court set a new session for March 2 to confirm the convictions after receiving the Mufti's non-binding opinion.In November, a military court had already sentenced Ashmawy to death in another terrorism case. Egyptian civilian and military courts had also sentenced Ashmawy to death in absentia before his extradition.