The Agriculture Department got rid of a political hot potato yesterday by agreeing to purchase 2.2 million pounds of surplus Maine spuds.

The agreement was enough to persuade Sen. William S. Cohen (R-Maine) to remove his Senate floor blockade of the nomination of Peter C. Myers as deputy secretary of agriculture.

Cohen and Maine's other senator, Democrat George J. Mitchell, were blocking the nomination in protest of USDA's treatment of Maine potato farmers.

And to make certain that their real target, Secretary Richard E. Lyng, got their point, Mitchell was also blocking the nomination of White House staffer Christopher Hicks as general counsel of USDA. Mitchell retained his "hold" on Hicks last night because, as an aide put it, "some issues are still not resolved."

Myers, recognizing a stake-and-potatoes issue when he saw it, said he agreed the Maine farmers had not quite gotten a fair shake from the department and that he would try his best to change the situation as it was rooted.

"We haven't treated them right in some respects," he said. "I grew potatoes as a youngster on my grandparents' Wisconsin farm, so I can at least relate to what the Maine potato farmers are going through. How else can Bill Cohen make his point? It's nothing personal -- I just happened to be in the way when he wanted to make the point."

The senators' first complaint was that Lyng and the Reagan administration recanted on a promise to crack down on Canadian potato imports.

Their second complaint was that Lyng did not buy as many Maine potatoes for federal feeding programs as he earlier promised.

"There is an overall indifference toward Maine farmers on the part of the department," said Robert Tyrer, an aide to Cohen. "There's no acknowledgment that Maine exists . . . . It's mildly irritating, to say the least. We want some attention for Maine farmers."

Earlier this year, USDA and the Customs Service had agreed to cut from seven to three the border points through which Canadian potatoes could enter the United States.

The idea was that federal inspectors could keep closer tabs on below-grade and mislabeled Canadian potatoes that were flooding into this country and undercutting Maine growers' markets.

But then the administration reversed itself. Tyrer said that Lyng told the Maine senators that the reversal was made so as not to offend Canada before its prime minister's March visit to President Reagan in Washington. Cohen and Mitchell were furious.

And they were really fried when Lyng, having agreed to buy 5 million pounds of Maine potatoes, announced the government would acquire only 2.8 million pounds. Yesterday's 2.2 million-pound purchase announcement fulfilled the original deal.

"They've also agreed to take a look at some export ideas," Tyrer said. "But if we don't make progress, we'd be only too happy to hold up some of the other nominations Agriculture has coming down the line."