The Dean of St Albans, the Very Reverend Jeffrey John, was not chosen as the Bishop of Llandaff earlier this month.
A current bishop said it would be "too much of a headache" to appoint him, he claimed.
The Church in Wales "strongly denied" the accusations of homophobia.
Dr John said he had been told appointing him would be difficult because he was in a civil partnership, although celibate in line with Church teaching.
He wrote to the Bishop of Swansea and Brecon - the Right Reverend John Davies, who is currently the Church's senior bishop - after an electoral college of bishops, clergy and lay people failed to reach a decision about who should replace Dr Barry Morgan as bishop.
It is understood Dr John received a majority of the votes, but not the two-thirds required by Church rules.
He said homophobic remarks had been made at the electoral college meeting.
"Much more importantly, the only arguments adduced against my appointment - in particular by two of the bishops - were directly related to my homosexuality and/or civil partnership - namely that my appointment would bring unwelcome and unsettling publicity to the diocese," he wrote.
Dr John said he had been told by a bishop by telephone they were "'just too exhausted' to deal with the problems they believed [his] appointment would cause."
"I put it to you that this is not a moral or legal basis on which to exclude me," Dr John wrote.
Under the Church's rules, the decision has passed to its bench of bishops, who failed to reach a decision when they met last week.
A Church in Wales spokeswoman told BBC News: "At the recent meeting of Electoral College no one candidate secured the necessary two-thirds majority to be elected Bishop of Llandaff. The appointment will now be made by the Church's bishops.
"After a process of consultation, they have drawn up a shortlist of names which is confidential. However, the Bishops strongly deny allegations of homophobia."
Dr John, who was born in Tonyrefail in Rhondda Cynon Taff, was nominated as Bishop of Reading in 2003, but was asked to withdraw from the role by the then-Archbishop of Canterbury, Rowan Williams.
He entered a civil partnership with Grant Holmes in 2006, but said at the time he had remained celibate, in line with Church teaching.
He is a public supporter of same-sex marriage, writing in the Church Times in 2012 that "theologically, ethically, and sacramentally, there is no difference between a gay couple and a heterosexual couple who cannot have children".
"So, yes, same-sex marriage can be as holy and sacramental as heterosexual marriage. Yes, God is in favour of gay marriage and so should the Church be," he added.
Gay rights campaigners have previously called for him to be made a bishop in Wales.
Dr John's nomination as Bishop of Reading caused controversy in 2003 when Dr Williams summoned him to Lambeth Palace and asked him to withdraw from the post.
Some conservative Anglican leaders had warned they would split from the communion if Dr John's consecration went ahead.
Friends of Dr John told the BBC last year that he had "painted the house, finished the episcopal training sessions, and been given the keys of the official car when the job was taken away".
A gay clergyman has accused the Anglican Church in Wales of homophobia after he was rejected for a job as a bishop.