* Red Cross urges all sides to observe "basic rules of war"
* Spare civilians, allow safe passage, evacuate wounded
* ICRC prepared to treat any victims of chemical warfare (Adds details, quotes, byline)
By Stephanie Nebehay
GENEVA, Oct 18 (Reuters) - The International Committee of the Red Cross appealed to all sides including Islamic State on Tuesday to show humanity on the battlefield and spare civilians in the Iraqi city of Mosul as government forces close in to re-take the city of 1.5 million.
Robert Mardini, ICRC regional director, said the agency had reminded the allies trying to dislodge the militants - the Iraqi government, Kurdish authorities and the U.S.-led coalition - of their duties under international humanitarian law.
It had not yet managed to establish dialogue with Islamic State, also known as ISIL, on the "basic rules of war".
"But our ambition, and we will do everything we can, (is) to establish dialogue with this group because it is holding the city of Mosul and we absolutely need to have this dialogue kick-started. So all what I can say now is we will continue to try and try harder," Mardini said.
He did not say what channels the ICRC might use to contact the militants.
"We need to keep hope, and maybe the situation in Mosul is a point in time when also all parties to the conflict, including the Islamic State group, will see the benefits of having the basic rules of war and the basic rules of dignity prevailing in the battle because it gives guarantees for humane treatment of all."
Iraqi and Kurdish forces closing in on Mosul said on Tuesday they had secured some 20 villages on the outskirts of the city in the first day of a U.S-backed operation to retake what is Islamic State's last major stronghold in Iraq.
Aid agencies are bracing for what they fear could be a humanitarian catastrophe.
Some 900 ICRC staff are deployed across Iraq and have spent months gearing up for its response to the crisis, Mardini said. In the first phase of fighting, the ICRC is poised to provide food, water and shelter for nearly 270,000 people fleeing Mosul.
He said in response to a question about possible IS use of chemical weapons that the agency had reinforced 13 medical centres in areas surrounding Mosul, including to treat any victims of gas attacks.
Explaining what he meant by the basic rules of warfare, Mardini said: "It means not targeting civilians, it means not targeting civilian infrastructure, it means not attacking medical facilities and medical personnel, it means avoiding use of heavy explosive weapons in densely populated areas."
"Our message to those who are fighting is very simple: put civilians first. Preserve your humanity in the heat of battle, show that humanity matters to you."
In the two years since it captured large tracts of Iraq and Syria and declared an Islamic caliphate, IS has become known for mass atrocities including rape and beheadings, and Mardini acknowledged that appealing to its humanity might seem idealistic.
"It might sound naive maybe in the wake of what we have seen so far but our position is firmly to pursue the same line and to bet on the humanity in each and every group involved in the fighting," he said. (Reporting by Stephanie Nebehay; Editing by Mark Trevelyan)