To prevent mushy potatoes, make sure to cook them just until they are tender but still firm. Avoid overcooking them. You can also cool the boiled potatoes completely before mixing them with other ingredients to maintain their texture.