Canada's Liberal party leader Justin Trudeau arrives at the venue for the Maclean's national leadership debate in Toronto August 6, 2015. REUTERS/Mark Blinch

By Randall Palmer and David Ljunggren

OTTAWA (Reuters) - Liberal leader Justin Trudeau, in desperate need of a boost to revive a struggling campaign, came out swinging at Conservative Prime Minister Stephen Harper on Thursday in the first debate ahead of Canada's Oct. 19 election.

Trudeau, derided by Harper and official opposition leader Thomas Mulcair as not being ready to take power, said Harper had failed to manage an economy suffering from low oil prices.

"Canadians across this country know that times are tough. And the fact is, you have become completely disconnected from the reality that people are facing right across the country," Trudeau told Harper.

The Conservatives, in power since 2006, are seeking a rare fourth consecutive mandate. Many polls show the party virtually tied with Mulcair's New Democrats.

The Liberals are trailing in third, and analysts said Trudeau needed to put in a strong performance to have any chance of recovery. The Liberals are competing with the New Democrats for the same centre-left segment of the electorate, and Trudeau also took several swings at Mulcair.

Harper acknowledged the economy is facing challenges but said only the low-tax centre-right Conservatives could be trusted to confront the problems.

"The way you deal with this is by sticking with ... a prudent plan that is working rather than go to a plan of high taxes and high debt and high deficits which is failing everywhere else," he said.

Harper accused both main opposition parties of wanting to raise spending by tens of billions of dollars, which he said was unsustainable.

Mulcair, whose party has never held power at the federal level, said that Canada had lost 400,000 well-paying manufacturing jobs.

"Obviously Mr Harper, we can't afford another four years of you," he said.

Both Harper and Trudeau attacked Mulcair for his position that the province of Quebec should be allowed to separate with a simple majority vote.

Trudeau, 43 and son of former Prime Minister Pierre Trudeau, has slipped steadily in public support amid opposition attacks that he is an intellectual lightweight.

Indeed, before the debate even started, Conservative campaign spokesman Kory Teneycke said expectations were so low that Trudeau would be deemed to have succeeded if he turned up for the debate with his pants on.

Trudeau, who won headlines in 2012 by whipping a Conservative senator in a charity boxing match, tried to revive some fighting spirit by sparring before cameras at a Toronto boxing gym earlier on Thursday.

(Editing by Jeffrey Hodgson, Alan Crosby and Ken Wills)