Sir Keir Starmer said Nigel Farage needed to "explain" himself after a newspaper published allegations that he used antisemitic and racist language when he was at school.
The prime minister also labelled the Reform UK leader "spineless" for not taking action against one of his MPs for "obvious racism".
Mr Farage has repeatedly denied the claims against him, with a party spokesperson labelling them "clearly without foundation".
Politics latest: Follow live updates
A Reform UK source said the prime minister was "desperate, sinking in the polls and lashing out".
The Guardian newspaper reported on Tuesday accounts from contemporaries of Mr Farage when he was at independent school Dulwich College, alleging that he made racist and antisemitic comments.
Speaking on the plane to the G20 summit in South Africa, the prime minister said the Reform UK leader needs to "explain the comments, or alleged comments that were made, and he needs to do that as soon as possible".
Sir Keir was also asked about Reform's Sarah Pochin MP saying last month that it "drives me mad when I see adverts full of black people, full of Asian people", which do not "reflect our society" - comments she later apologised for.
But while Mr Farage told reporters he was "unhappy" about the "ugly" remarks, he said they were not "racist".
The prime minister labelled them "clearly racist", however, and hit out directly at the Reform UK leader.
Read more:
Farage 'unhappy' with Pochin's comments
Starmer says he'll lead Labour into next election
He told reporters: "The man is spineless. If that had been someone in my party, I'd have dealt with it straight away.
"He needs to explain the latest allegations, and whilst he's at it, he needs to explain why he's too spineless to take action in relation to what is obvious racism in the comments of his fellow MP."
? Click here to listen to Electoral Dysfunction on your podcast app ?
Sir Keir added that Mr Farage has failed to show "some leadership when it comes to racism".
In a statement in response to the prime minister's comments, Mr Farage said: "For the weakest prime minister in living memory to call me spineless is utterly ludicrous.
"The voters will have their say on both of us at the ballot box next May."
(c) Sky News 2025: Farage needs to explain 'racist' comment allegations from school days, says PM

Trump's 28-point Ukraine peace plan in full
Billion-pound money laundering network operating in 28 towns and cities in UK
Plane crashes at Dubai air show, killing pilot
Change to forecast imminent after big freeze