A convicted child rapist who allegedly tried to lure a boy out walking a dog over towards his home must remain in custody, a High Court judge has ruled.