OTTAWA, April 12 (Reuters) - Canada plans to build nearly 3.9 million houses by 2031 under a new federal initiative, Prime Minister Justin Trudeau said on Friday, as the country grapples with a gulf between demand and supply of accommodation.

The plan, though, still falls short by almost a third compared to projections of what is needed, according to the Canada Mortgage and Housing Corporation (CMHC), the national housing agency.

It estimates that 5.1 million units will be needed over 2023 to 2030 to bridge the gap.

Polls show that soaring housing and rental prices are one of the reasons Trudeau's Liberals are lagging their Conservative rivals ahead of an election that must be held by October 2025.

"It is a plan that is actually going to make a difference in the lives of Canadians," Trudeau told reporters in Vaughan, Ontario.

The plan calls for 3.87 million new homes by 2031, two million more than the 1.87 million the CMHC has already forecast will be built by 2031.

The plan is part of a housing package that is set to dominate next week's federal budget.

Canada's shortage of housing supply is largely due to a rapidly increasing immigrant population which has far outpaced the number of available homes. Stubbornly high shelter inflation and high interest rates have also driven up costs.

Housing in Canada is largely the responsibility of the 10 provinces and major municipalities. Ottawa, which has no direct role in construction, must therefore rely on policy measures and funding to ensure its partners respond.

Mike Moffatt of the Task Force for Housing and Climate, an independent think tank, said Ottawa would need to attract close to C$2 trillion ($1.45 trillion) to achieve the target.

"We are going to need to see more on the math and we will need to see more on (the cost) in the budget. But I think overall we have seen some pretty significant reforms in today's package," he told the Canadian Broadcasting Corp.

Top government ministers have been touring the country in the last two weeks to announce a raft of housing measures and pledge billions of dollars to build more homes.

The plan announced on Friday includes the measures announced in recent weeks, such as a proposals to extend low-cost loans, rapid use of federal land for building houses, cracking down on mortgage fraud that is artificially inflating cost of houses, Housing Minister Sean Fraser said.

($1 = 1.3760 Canadian dollars) (Additional reporting by Nivedita Balu and Ismail Shakil, editing by David Ljunggren and Aurora Ellis)