Another 10-year-old boy was also cleared of indecent assault in the alleged attack at the boys' primary school in May last year.
Mrs Justice Bracewell told the jury that there was a "two-fold" reason for directing that there was no evidence for them to consider over the rape allegations.
One was that in the case of one of the boys accused of rape, the alleged victim "did not positively identify him". More fundamentally, said the judge, was the fact that during a police interview with the girl a police officer had "asked a question that was both leading and wholly improper, which in effect put words into the girl's mouth".
A third boy alleged to have raped her could not be prosecuted as he was just nine at the time and under the age of criminal responsibility.
The two boys cleared of rape and a fourth boy, an 11-year-old cousin of the alleged victim, face a charge of indecent assault and trial continues. All defendants had denied all the charges.Reuse content