"People from Afghanistan and Pakistan wanted to cross Iran but we prevented them passing and we have arrested others," Interior Minister Abdolreza Rahmani Fazli said, linking them to IS.
The report, carried by the official IRNA news agency, did not specify how many arrests had been made or where the detentions occurred.
Iran shares a border with Pakistan and Afghanistan to the east and Iraq to the west.
"Our forces are particularly vigilant in the border areas given that they face threats from terrorist groups," the minister added.
US troops left Iraq in 2011 but the rapid advance of IS into Iraq from Syria in June forced Washington to send military advisers to Baghdad and cooperation has since expanded to air strikes on militant targets.
Iran has also sent military assistance to Iraq but has denied that it has any troops on the ground.