Gove, the education minister, confirmed for the first time that he believes that leaving the EU would have "certain advantages", while Hammond, the defence secretary, later said he too would vote to leave if he was asked to endorse the EU "exactly as it is today".

The timing of their comments will cause consternation for the prime minister as he attends talks with Barack Obama in the White House, where he will press for an EU-US trade deal that he claims would bring £10bn of annual benefits to Britain.

The remarks, which follow similar calls by Lord Lawson and Michael Portillo last week for Britain to leave Europe, are particularly significant because they are the first cabinet ministers to say they would vote to quit if an immediate referendum were held.

The prime minister's enthusiastic endorsement of an EU trade deal, which will be negotiated with the US by the EU as a whole, stood in marked contrast to the intervention by Gove, who said Britain could prosper outside the EU.

Dozens of Tory MPs are preparing to vote in favour of a backbench amendment to the motion welcoming the Queen's speech, which is expected on Wednesday, regretting the absence of an in/out referendum on Britain's EU membership.

The remarks by Gove, described as "unhelpful" by party officials, went slightly further than Hammond, who said that it was "defeatist" to argue in favour of withdrawal because the prime minister would negotiate a better deal for Britain.

Gove told the Andrew Marr Show on BBC1 that he would abstain in the vote after No 10 said ministers would be free to take the rare step of declining to offer wholehearted support for the Queen's speech. No 10 is offering backbenchers a free vote and ministers the right to abstain.

The prime minister says that, if elected with a majority in 2015, he would hold a referendum by 2017. This would take place after a renegotiation of Britain's membership terms.

Friends of Gove told the Mail on Sunday last year he had said Britain should leave the EU unless substantial powers were repatriated. Asked whether he stood by those private remarks, he said: "Yes, I'm not happy with our position in the EU."

Gove said he supported the prime minister's plan to renegotiate the terms of Britain's EU membership after the election. But he added that life outside the EU could have benefits. "My preference is for a change in Britain's relationship with the European Union. My ideal is exactly what the majority of the British public's ideal is, which is to recognise the current situation is no good, to say that life outside would be perfectly tolerable, we could contemplate it, there would be certain advantages.

"But the best deal for Europe, and for Britain, would be if Britain were to lead the change that Europe needs." Explaining his abstention, he said: "I'm going to abstain ... it's an exercise in letting off steam."

Hammond, interviewed for Pienaar's Politics on BBC radio, later said: "If the choice is between a European Union written exactly as it is today and not being a part of that then I have to say that I'm on the side of the argument that Michael Gove has put forward."

Theresa May, the home secretary, said she too would abstain. But she declined to say whether she would vote to leave the EU if a referendum were held now. The prime minister will be in the US when the Commons vote is held.

Boris Johnson backed Tory backbench demands for an EU referendum bill and warned Cameron he must make it clear Britain is "ready to walk away" unless its relationship is fundamentally reformed,

But the mayor of London also suggested that leaving the EU would expose the idea that most of Britain's problems are self-inflicted. "If we left the EU, we would end this sterile debate, and we would have to recognise that most of our problems are not caused by 'Bwussels', but by chronic British short-termism, inadequate management, sloth, low skills, a culture of easy gratification and underinvestment in both human and physical capital and infrastructure," Johnson wrote in his Daily Telegraph column.

"Why are we still, person for person, so much less productive than the Germans? That is now a question more than a century old, and the answer is nothing to do with the EU. In or out of the EU, we must have a clear vision of how we are going to be competitive in a global economy."

Ministers have been excluded from a free vote granted to Tory backbenchers to support the rebel amendment – with about 100 MPs expected to take the rare step of formally criticising their own government's legislative programme. At least two parliamentary private secretaries are expected to vote for the amendment.

Supporters of the amendment believe that the party must take on board traditional Tory voters' views after large numbers voted Ukip in this month's local elections.

Cameron will show he believes Britain's long-term future lies in the EU by saying at the meeting with Obama that next month's G8 summit must launch negotiations on the EU-US free trade area. In an article in the Wall Street Journal, he writes: "The free trade area between Europe and the US ... could add as much as £10bn to the British economy and £63bn to US GDP."

Cameron, who has said that he too is not happy with the EU status quo, will nevertheless show he believes Britain has a long term future in the EU when he speaks of how the EU-US trade deal will provide a dramatic boost to economic growth. Pro-Europeans say that trade deals negotiated by the EU are more successful than those that would be negotiated by Britain outside the EU because the European trade commissioner, Karel De Gucht, negotiates for more than 500 million people. Opponents of the EU complain that trade deals negotiated by Brussels represent an unacceptable loss of sovereignty for Britain.

The prime minister's decision to highlight the benefits of EU membership is likely to be welcomed by Obama, whose advisers expressed concern in the runup to Cameron's EU speech in January, when he outlined his referendum plan.