The detergent action of soap is due to its
Emulsifying property
Soap anions emulsifies oil and water. The molecule of soap constitutes sodium or potassium salts of long chain carboxylic acids. The carbon chain dissolves in oil and the ionic end dissolves in water. Thus the soap molecules form structures called micelles .In micelles one end is towards the oil droplet and the other end which is the ionic faces outside. Therefore, it forms emulsion in water and helps in dissolving the dirt r when we wash our clothes.