Abdelmajid Touil, who arrived in Italy in February on a migrant boat and was arrested in May, is accused by Tunisia of providing “logistical support” to the two gunmen who stormed the Bardo National Museum in an attack that left 22 dead.
But Touil, who was in Italy at the time of the March attack in Tunis, insists he is innocent.
The court said the death penalty risk “prevents his extradition”, adding that Touil could face prosecution in Italy.
“The bilateral agreement for extradition between Italy and Tunisia provides no mechanism to convert the death penalty into another prison sentence,” said Canzio Giovanni, president of Milan's court of appeal.
“In addition, the Tunisian authorities did not provide any assurance on the non-implementation of the death penalty,” he said in a statement.
Touil is still under investigation for international terrorism and could be prosecuted in Italy, the court said.
The Islamic State jihadist group has claimed responsibility for the attack, in which two young Tunisians gunned down 21 foreign tourists and a policeman before being shot dead.
The group also claimed a June attack in which a gunman massacred 38 tourists on a Tunisian beach.
Tunisia has since its 2011 revolution faced an upsurge in jihadist violence that has cost the lives of dozens of soldiers and police, with most attacks claimed by Al-Qaeda's north African branch.