Libyan security officials said two bombs exploded at the gate of the Iranian ambassador's residence in the Libyan capital, Tripoli, on February 22.
Nobody was hurt in the blast, which caused minimum damage to the empty building, the officials told local media.
Iran's state news agency IRNA confirmed the bombings, saying that work at the building had been suspended some time ago.
Militants claiming loyalty to the Islamic State militant organization claimed responsibility for the attack.
On February 20, the same militants claimed responsibility for a bombing in the eastern town of Qubbah that killed more than 40 people.
Most Western countries and the United Nations moved out their staff last year during fighting between rival factions vying for control of Tripoli, four years after the fall of Muammar Qaddafi.