The chief minister has suspended JB Singh, the district magistrate of Gonda, and Kumar Prashant, the district magistrate of Fatehpur near the Bundelkhand region.
Press notes issued by the government's information department said the Fatehpur district magistrate was being suspended because of grave irregularities in the purchase of wheat grain from farmers.
The Gonda district magistrate has been accused of irregularities in the distribution of grain to the poor under the Public Distribution system.
The UP government has not detailed specific charges against the officers.
Since the by-poll losses in western UP last month, Yogi Adityanath has confronted open criticism by legislators of his party, the BJP.
"It is my opinion. Corruption is on the rise and that is the only reason...People are working with their own mind. The Chief Minister should work harder and look into this. They must, otherwise it won't work," Shyam Prakash had said.
Another BJP legislator, Surendra Singh, has blamed ministers in the Yogi Adityanath government for the defeats. He had said if certain ministers were not removed from the state cabinet, the ruling party was bound to crash in UP. The BJP government has not been able to give a transparent government," the lawmaker had said in a remark that embarrassed the party.
After losing a string of by-polls, including in his own base Gorakhpur, Chief Minister Adityanath has been touring various districts of the state and holding review meetings with officials.
Election Results for Lok Sabha Election 2019 will be out on May 23. Get the latest election news and live updates on ndtv.com/elections. Catch all the action on NDTV Live. Like us on Facebook or follow us on Twitter and Instagram for news updates from each of the 543 parliamentary seats for the election 2019