(Adds details on vote timing, lawmaker comment in paragraphs 7-8, TV)
WASHINGTON, March 22 (Reuters) - The U.S. Congress was racing on Thursday to approve a massive spending bill and send it to President Donald Trump for enactment before a midnight Friday government shutdown deadline, in a move that would significantly boost defense and non-military funding through Sept. 30.
The House of Representatives planned to debate and vote on the measure later on Thursday morning. If it clears the chamber, despite opposition from some conservatives protesting the bill's crushing deficit spending, it is likely to have an easier time clearing the Senate.
Passage would end several months of intense bickering between Republicans and Democrats over spending priorities, which led to two short government shutdowns earlier this year.
It also would deliver a setback to Trump, whose proposals for severe cuts to the Environmental Protection Agency, State Department and other federal agencies would be scaled back.
The bill, which also excludes some of Trump's immigration-related funding requests, was unveiled late on Wednesday.
Earlier on Wednesday, the White House signaled that Trump would sign the legislation if Congress sends it to him.
House Republicans' conservative Freedom Caucus on Thursday said its roughly three dozen members would not back the bill because it massively increases spending while not defunding Obamacare, Planned Parenthood and so-called sanctuary cities. "You're going to see lots of conservatives vote against it," U.S. Representative Jim Jordan, a caucus member, told Fox News in an interview, adding that Trump was backing the measure because "it's the only bill they put in front of him."
Trump at one point wanted $25 billion included in the bill to fully fund construction of his proposed U.S.-Mexico border wall, but negotiations with Democrats to make that happen fell apart early this week, according to congressional aides.
Instead, Trump would get nearly $1.6 billion more for border security this year. More border patrol agents could be hired, but there would not be the significant increase in immigration agents working the interior of the country.
The Department of Homeland Security had sought a big buildup in those officers to boost deportation of undocumented immigrants.
Trump, in a post on Twitter late on Wednesday, said the funding bill will allow him to start building a wall on the southwest U.S. border with Mexico. "Got $1.6 Billion to start Wall on Southern Border, rest will be forthcoming," he wrote.
But Democrats argued the added funds will help build or restore a range of other barriers, including existing fencing, and would not pay for a concrete edifice that Trump originally said would be financed by Mexico - a claim Mexico City has denounced.
Besides the $80 billion boost in military spending, the largest in 15 years, the measure includes new money for infrastructure improvements and combating Russian election hacking.
In response to public anger and frustration over mass shootings, including a Feb. 14 massacre at a Florida high school, the bill contains modest improvements to background checks for gun sales and grants to help schools prevent gun violence.
These provisions were far short of steps many Democrats and gun control groups say are needed to stop the shooting deaths of school children, concert-goers, church worshipers and others.
A so-called "grain glitch" included in a tax law enacted at the end of last year would be repaired by the legislation.
Big grain buyers, such as Anheuser Busch Inbev NV, Cargill Inc and the ethanol industry, have complained the glitch gives lucrative tax breaks to grain producers for selling to farming cooperatives, and a lesser break for selling to agriculture companies.
The bill will provide a $307 million increase above the administration's request for counter-intelligence efforts to fight Russian cyberattacks in 2018, when U.S. mid-term congressional elections will be held, and $380 million for grants to states to secure their election systems.
Other components of the bill include $10 billion in infrastructure spending for highways, airports, railroads and broadband, and a $2.8 billion increase to fund treatment and prevention of opioid addiction and research into the subject. (Additional reporting by Susan Heavey Editing by Eric Walsh, Michael Perry and Bernadette Baum)