Speaking on the eve of the party’s annual conference in Liverpool, Mr McDonnell warned of the risk that a re-run vote could stoke far-right populism and xenophobia.
The shadow chancellor also suggested the rail industry could be renationalised within five years under a Labour government.
He told BBC Radio 4’s Today programme it would be “possible” to bring all franchises back under public control during a single term in office, amid reports he is planning a Public Ownership Unit within the Treasury to deal with renationalisations.
Labour promised to “put equality centre stage” at its Women’s Conference, taking place on Saturday a day ahead of the main gathering in Liverpool.
Shadow women and equalities secretary Dawn Butler unveiled plans to establish a stand-alone department for women and equalities with a minister at the Cabinet table in a future Labour government.
But the main conference is expected to be dominated by squabbles over Brexit and the future of the party.
More than 100 constituency parties and trade union branches have submitted bids for the referendum issue to be put to a vote in Liverpool.
And MPs and senior trade unionists are set to join a People’s Vote march in the city on Sunday.
So far Labour leader Jeremy Corbyn has resisted such calls, preferring to press for a general election if - as many MPs expect - Theresa May is unable to get a Brexit deal through Parliament.
And Mr McDonnell signalled the party’s position in that event would be unchanged from last year’s snap election.
“We would be in the same situation there, where we would be saying we’re accepting that original vote, this is the sort of deal that we want,” he told The Guardian.
“The debate around the next manifesto will go on, but I really worry about another referendum.
“I’m desperately trying to avoid any rise of xenophobia that happened last time around, I’m desperately trying to avoid giving any opportunity to Ukip or the far right. I think there’s the real risk of that.
“We’re not ruling out a people’s vote, but there’s a real risk, and I think people need to take that into account when we’re arguing for one.”
Responding to Mr McDonnell’s comments, the anti-Brexit leader of the TSSA union, Manuel Cortes, said in a tweet: “You don’t kill xenophobia by aping the policies of Ukip - you need to defeat them!”
And Labour’s former foreign secretary David Miliband told Today: “Labour’s got to be much much stronger. Waiting for the Government to foul up is not a strategy at all.
“It’s an absolute dereliction of duty in my view for the Labour Party leadership not to embrace the fundamental principle that since the Brexit that people were sold two years ago is not available, it’s essential that the Brexit deal the Prime Minister does is put to people.”
Mr Corbyn hopes to use the conference, held under the slogan “Rebuilding Britain, for the many, not the few”, to put behind him a difficult summer dominated by a bitter row over anti-Semitism.
But while the leadership aims to shift the focus on to expected high-profile policy announcements on issues like housing and business, Brexit and party infighting are likely to make the headlines.
The party’s National Executive Committee (NEC) will meet on Saturday to discuss changes to leadership election rules, which left-wing activists claim could keep supporters of Mr Corbyn off the ballot.
At the same time, the activist group Momentum which helped propel Mr Corbyn to the leadership is pushing for another rule change which could make it easier to de-select sitting MPs.
It is likely to revive fears among critics of Mr Corbyn of a left-wing purge of the moderates - including some of his fiercest critics in the row over anti-Semitism.
At the Labour Women’s Conference, Ms Butler will say equality should no longer be considered an “afterthought”.
She will say: “So far we have seen seven different ministers for equality tagged on to four different departments and a budget that’s nearly been halved.
“This proves the Tories are not taking equalities seriously. By establishing a Department for Women and Equalities, Labour will ensure equalities is the common thread running through its government.
“The next Labour government will put equality centre stage.”
She will also announce plans to introduce a requirement for all employers to have a domestic abuse policy and provide 10 days’ paid leave for victims, if Labour win power.
“Employers have a duty of care to employees experiencing domestic abuse and should put in place a range of workplace policies to help victims,” Ms Butler is expected to say.
“This crucial time will allow women to leave their abusive partners safely, get the help, protection and support they need, knowing their livelihood is secure.
“These 10 days could literally help save the lives of those women.”