"Soap is useful for washing something."
Translation:Sapo estas utila por lavi ion.
Why is ion accusative case when it is after esti? Or is it considered after lavi, which is in a preposition phrase.
It's with lavi, as you say. There are two sub-parts to the sentence: sapo estas utila, which could stand as a sentence in its own right (and because it's got estas as its verb, there's no accusative); but then it's followed by ...por lavi ion, where the verb is lavi, which is a verb that takes an object, so that's where the -n is needed.