The terrorists were involved in recent attacks against security forces in North Sinai which left a number of police and army personnel killed, the Interior Ministry said in a statement.
Police attacked the farm in Sharqeya Governorate, killing the nine terrorists in an exchange of fire.
Nine other terrorists were arrested in Cairo in a separate raid. Four of the nine arrested terrorists were engaged in an attack on a security point in July, which left a conscript and a civilian injured.
Egypt especially the restive North Sinai has witnessed many terrorist attacks since the January 2011 revolution that toppled ex-president Hosni Mubarak.
More From This Section
The attacks, mainly targeting police and military, increased after the ouster of Islamist ex-president Mohamed Morsi in 2013 by military following massive protests against his rule.
Hundreds of police and army personnel have been killed since then. The military has launched security campaigns in the North Sinai area.
The security forces have arrested suspects and demolished houses that belong to terrorists, including those facilitating tunnels leading to the Gaza Strip.