Richard Walsh, 43, was accused of attacking the two schoolboys, aged 12 and 13, in Havant, last month.
He had been in custody at Belmarsh Prison in south-east London.
Prison staff found Mr Walsh unresponsive in his cell on Sunday morning and, despite efforts to revive him, he was pronounced dead.
A Prison Service spokeswoman said: "HMP Belmarsh prisoner Richard Walsh was found unresponsive in his cell on Sunday 19 July. Staff attempted CPR but paramedics pronounced him dead at 11.07am.
"As with all deaths in custody there will be an investigation by the independent Prisons and Probation Ombudsman."
Mr Walsh, who was also charged with assault and robbery in relating to the taking of a bicycle, had been due to appear at Portsmouth Crown Court on Monday.

South African firm Famous Brands signed a £120m deal to buy the chain from Nando's owner, Capricorn Ventures.
Gourmet Burger Kitchen, founded in 2001, was a "pioneer of the premium burger revolution", Famous Brands said.
The company says that it wants to open 10 to 15 more burger restaurants a year in the UK.
The mass-market burger giants, McDonalds and Burger King, first opened in the UK in the 1970s. While those brands have continued to expand, by the end of the 1990s a new fashion for more expensive burgers had arrived, again from the US.
Upmarket burger brands in the UK now include Byron, Shake Shack and Five Guys, as well as an increasing number of independents. According to analysts Mintel, the premium burger market now accounts for sales worth more than £3bn a year.
Famous Brands plans to double Gourmet Burger Kitchen's 75 UK stores in the next five years and said Brexit uncertainty would not affect its plans.
Consumers still want food that is quick and convenient, but are willing to pay for better ingredients, said Famous Brands' Kevin Hedderwick.
"The fast-casual premium environment is pretty recession-proof," he said.
The price difference between upmarket and fast-food burger shops is quite striking.
Whereas a typical McDonald's quarter-pounder with cheese will set you back less than £3, a Gourmet Burger Kitchen 4oz classic cheeseburger is more than £6. But Gourmet Burger Kitchen also sells more unusual fare, including buffalo burgers and Persian lamb.
Food fashions in the UK range from the super-health-conscious to the indulgent. And at the indulgent end of the scale, consumers are focusing on the quality of the ingredients and being able to personalise the menu, by selecting different options.
"Consumers see freshly made burgers as the biggest marker of a gourmet burger venue, something that sets them apart, as this is not traditionally offered by fast food venues," said Kiti Soininen, head of UK food and drink research at Mintel.
"Customisation is also a top expectation for gourmet offerings, in line with a more general demand for knowing what goes into one's food and the trend for personalisation."

The dead driver was not a member of ambulance staff, police said, and working out how he was in the ambulance would form part of their inquiries.
The Coastliner bus driver was seriously injured in the crash on the A64 at Flaxton, near York, at about 20:30 BST.
Five of the 16 passengers on the bus and one of two people in the Toyota Yaris car were also taken to hospital.
Yorkshire Ambulance Service said they could not confirm who the private ambulance belonged to but said it was not an NHS vehicle.
The driver was pronounced dead at the scene. Police said there was nobody else in the vehicle with him.
The bus driver was taken to Leeds General Infirmary, with serious but not life-threatening leg and abdominal injuries. The emergency services said the passengers were taken to hospitals in York and Scarborough and their injuries were also not life-threatening.
The ambulance service said it was thought other passengers may have gone to hospital without their assistance and about four people received attention for minor injuries at the scene.
The A64 has been closed while collision investigators examine the scene and police said it would remain shut for some time. They asked motorists to avoid the A64 near York.
North Yorkshire Police are asking anyone who witnessed the crash or saw either of the vehicles before the collision, to contact them.
A man who was facing trial for the attempted murder of two boys who were stabbed in a street in Hampshire has been found dead in his prison cell.
[NEXT_CONCEPT]
Wimpy owner Famous Brands has swallowed UK chain Gourmet Burger Kitchen, as the fashion for upmarket burgers in the UK shows no signs of slowing down.
[NEXT_CONCEPT]
A man driving a private ambulance has died in a crash with a double decker bus and a car in North Yorkshire.