Supreme Leader Ayatollah Ali Khamenei's warning came as Iran summoned Riyadh's envoy for the fourth time since last Thursday's deadly crush of pilgrims to protest what it called the kingdom's "mishandling" of the incident.
Saudi authorities say 769 pilgrims died in the stampede near Mecca in the worst disaster to strike the annual pilgrimage in a quarter-century. Iran appears to have lost the largest number of pilgrims, with 239 dead.
Tehran says 241 Iranian pilgrims remain unaccounted for, and Iran's state media have accused Saudi Arabia of a cover-up, saying the total death toll exceeds 4,700. It has offered no evidence to corroborate the claim.
The disaster has fed into the bitter regional rivalry between Sunni Saudi Arabia and Shiite Iran, which back opposite sides in the wars in Syria and Yemen.
Iran has led a chorus of international criticism directed at Saudi Arabia's response to the incident, saying its diplomats were not given access to victims until days after the stampede.
Iranians have staged daily protests near the Saudi Embassy in Tehran, and President Hassan Rouhani devoted a significant part of his speech at the U.N. General Assembly on Monday to blaming Saudi authorities for the disaster and demanding it be "fully investigated."
Khamenei said Saudi Arabia "will not be in a good situation" if it disrespects Iranian pilgrims or fails to repatriate bodies.
"The Saudi government is not carrying out its obligation to repatriate and in some cases shows slyness," Khamenei told military commanders in northern Iran in comments broadcast on state TV.
"The Islamic Republic of Iran has so far showed self-restraint, observed Islamic decency and brotherly respect in the Islamic world, but they should know that Iran's hand is superior to many others and has more capabilities. If (Iran) wants to react to disturbing and sinister elements, their situation will not be good."
Khamenei has already called on Saudi Arabia to apologize to Muslim nations and accept responsibility for the hajj disaster.
The pilgrims suffocated or were trampled to death when two massive crowds converged on a narrow street in the tent city of Mina, just outside Mecca. Saudi Arabia has launched an investigation and says officials will be held accountable if it finds that mistakes were made.
The hajj pilgrimage is one of the five pillars of Islam, and all able-bodied Muslims are required to undertake it once in their lives. This year some 2 million pilgrims from 180 countries took part in the hajj.
The pilgrimage poses a major logistical challenge for Saudi Arabia, but the country has hosted more than 3 million pilgrims in recent years without any major incidents.