A defense motion Tuesday accuses Montgomery County Judge Steven O'Neill of having a longtime grudge against a key witness in a 2016 pretrial hearing.
The witness, ex-prosecutor Bruce Castor, says he declined the case in 2005 and promised Cosby that he could never be prosecuted over the 2004 encounter with a woman at his home.
O'Neill found no evidence of a binding agreement and sent the case to trial.
Cosby faces sentencing Sept. 24 after he was convicted of three felonies this spring.
He faces up to 10 years in prison on each count.
O'Neill's office did not immediately return a call for comment.
Camille Cosby in a separate statement Tuesday calls O'Neill's alleged bias in her husband's case a "horrible injustice."
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.