On 14 March 1918 he worked to the trade commission of Mykola Porsh for the goods exchange with the Central Powers and responsible to the Council of People's Ministers.
After the Directorate of Ukraine forced Pavlo Skoropadskyi to emigrate, Ostapenko, being a member of the Ukrainian SR party and was appointed to the socialist government of Volodymyr Chekhivsky as the minister of trade and industry.
In February 1919 when the government of Ukraine had to relocate out of Kyiv to Vinnytsia with the advancing Bolshevik forces, Ostapenko discontinued his membership with the Ukrainian SRs.
On February 6, 1919 he participated as the representative of the Ukrainian government in the negotiations with the Chief of staff of the French military forces of Colonel Freidenberg (see Entente intervention) at the railroad station of Birzula, near Odesa.
The Ukrainians were requesting from the representatives of the Entente recognition of the sovereignty of Ukraine, allowing it to participate at the Paris Peace Conference, and several other important factors.
After some successes at the Bolshevik front and the liberation of Podolia, he moved to Kamianets-Podilskyi that since June 1919 served as the temporary administrative center of the Ukrainian People's Republic until the end of 1919.
Still unable to find a job, Ostapenko applied to the Kamyanets-Podilsky State University that was hiring numerous professors and private-docents in various fields.
On 18 July 1919 the minister of education Anton Krushelnytsky accepted his application by the reference of the University's first rector Ilarion Ohienko.
In May 1921 the Supreme Extraordinary Tribunal began the hearing of the affair of Ukrainian SRs on which Ostapenko was invited as a witness.