When a finite contrast petawatt laser pulse irradiates a micron-thick foil, a prepulse (including amplified spontaneous emission) creates a preplasma, where an ultrashort relativistically strong portion of the laser pulse (the main pulse) acquires higher intensity due to relativistic self-focusing and undergoes fast depletion transferring energy to fast electrons. If the preplasma thickness is optimal, the main pulse can reach the target generating fast ions more efficiently than an ideal, infinite contrast, laser pulse. A simple analytical model of a target with preplasma formation is developed and the radiation pressure dominant acceleration of ions in this target is predicted. The preplasma formation by a nanosecond prepulse is analyzed with dissipative hydrodynamic simulations. The main pulse interaction with the preplasma is studied with multi-parametric particle-in-cell simulations. The optimal conditions for hundreds of MeV ion acceleration are found with accompanying effects important for diagnostics, including high-order harmonics generation.