The Labour leader said the weather that has been wreaking havoc should serve as a “wake up call”, describing it as “extraordinary” that Mr Cameron was portraying climate change merely as “a matter of conscience” when it had been a “core conviction” when he was in opposition.
The attack came as Defence Secretary Philip Hammond conceded the military could have been brought in earlier to help cope with the crisis.
Large swathes of the UK remain on high alert as people battle to protect their homes from the floodwaters.
In a newspaper interview, Mr Miliband stressed that “something is going on” with the climate, pointing to the fact that 2012 saw the second wettest winter on record and that this winter was a “one in 250 year event” so far.
He said: “If you keep throwing the dice and you keep getting sixes then the dice are loaded. Something is going on.
“The events of the last few weeks have shown this is a national security issue in our own country too, with people’s homes, businesses and livelihoods coming under attack from extreme weather. And we know this will happen more in the future.”
Calling for the cross-party consensus on climate change to be rebuilt, Mr Miliband said: “The science is clear. The public know there is a problem. But, because of political division in Westminster, we are sleepwalking into a national security crisis on climate change. The terrible events of the last few weeks should serve as a wake-up call for us all.”
Mr Miliband said he had “genuinely believed” Mr Cameron was sincere about his passion for green issues while in opposition, but the sacking of Charles Hendry as energy minister and the appointment of Owen Paterson – widely viewed as a climate change sceptic – as environment secretary suggested otherwise.
Recently the Conservative leader said: “Clearly we have had and are having some pretty extreme weather. So whatever your view about climate change, it makes sense to mitigate it and act to deal with that weather.”
Mr Miliband insisted such “ambivalence” could be disastrous for Britain, adding: “It is pretty extraordinary that it has gone from a core conviction … to a matter of conscience as to whether you believe it or not.
“The reality is that the action we take as a country depends on whether you believe in climate change. If you believe that the climate has been changing for centuries and that this is no different, then why would you believe it is necessary to take all the measures that are required?
“When the government downgrades flood protection, cuts the floods budgets, cuts the adaptation budget – all of those things – that has an impact.”
However, energy secretary Ed Davey said the coalition government was working hard to tackle climate change, adding that Mr Miliband had his own questions to answer on the subject.
The Liberal Democrat minister said: “If Miliband is serious about tackling climate change he should stop threatening to choke the renewables industry with his price freeze.
“This government is doing more to tackle climate change than any other government before, with renewable energy investment higher than at any time under the last government.”
Mr Hammond said climate change was “clearly a factor” in recent weather patterns and the government was investing “significant amounts of money in increasing our flood resilience”.
A Department of Energy and Climate Change spokeswoman said the scientific evidence behind climate change was “clear”, with Britain having adopted some of the “most ambitious climate change targets in the world” to tackle the threat.
She said: “The government is planning for the impacts of extreme weather and will continue to do all it can. We are spending £2.4 billion on flood management and protection from coastal erosion over four years. That is more than ever before.”
Meanwhile, in its latest update, the Environment Agency said last night that severe flood warnings remain in place along the Thames and in Somerset, where water levels continue to rise, although the “overall picture is starting to improve”.
The Thames Barrier was closed yesterday at 11am for a record 18th consecutive tide, while the largest pumping operation ever undertaken in Somerset continued, with 54 pumps working around the clock to drain more than one million tonnes of water per day.
Although the threat of tidal flooding is now receding, members of the public were urged to remain away from seafronts as waves remained high.
First Great Western said it plans to restore the majority of services in and out of London Paddington from today.
The train company, which has been the worst affected by the weather, said it hoped to run a near normal service on high speed routes into and out of London with the exception of the route closures at Dawlish in Devon and between Bridgwater and Taunton in Somerset.