There is one reference in Mahabharata that clearly states that Varna is independent of birth and specifies conduct to be the only ground.
Maheshwara said, ‘..Neither birth, nor the purificatory rites, nor
learning, nor offspring, can be regarded as grounds for conferring
upon one the regenerate status. Verily, the conduct is the only
ground. All Brahmanas in this world are Brahmanas in consequence of
conduct. A Sudra, if he is established on good conduct, is regarded as
possessed of the status of a Brahmana. The status of a Brahma, O
auspicious lady [Uma], is equal wherever it exists. Even this is my
opinion. He, indeed, is a Brahmana in which the status of Brahma
exists – that condition which is bereft of attributes and which has no
stain attached to it. of human beings in four orders dependent on
birth is only for purposes of classification.The boon giving Brahma,
when he created all creatures, himself said that the distribution of
human beings in four orders dependent on birth is only for purposes of
classification.'
Mahabharata Anusasana Parva Section CXLIII
Moreover the birth based caste system is an invalid system since it violates the guidelines given in Hindu scriptures.
Guidelines
Everything written in Hindu scripture is not valid. A scriptural statement can be invalid if it does not satisfy reason.
Primacy of reason
Bhishma Said:
Even the words heard from an ignorant person, if in themselves they be
fraught with sense, come to be regarded as pious and wise. In days of
old, Usanas said unto the Daityas this truth, which should remove all
doubts, that scriptures are no scriptures if they cannot stand the
test of reason.
Mahabharata Shanti Parva Section CXLII
Acharya Shankara says:
The appeal to the infallibility of the Vedic injunction is
misconceived. The infallibility in question refers only to the unseen
forces or apurva, and is admissible only in regards to matters not
confined to the sphere of direct perceptions, etc ... Even a hundred
statements of sruti to the effect that fire is cold and non-luminous
won't prove valid. If it does make such a statement, its import will
have to be interpreted differently. Otherwise, validity won't attach
to it. Nothing in conflict with the means of valid cognition or with
its own statements may be imputed to sruti.
REF: Srimad Bhagavad Gita Bhasya 18.66 of Sri Sankaracarya translation by Dr. A. G. Krishna Warrier, p. 629.
Rejection of discriminatory verses
Any discriminatory verse in Hindu scripture is also automatically invalid according to Hindu scripture and should not be followed. This is necessary because Hinduism is not an organized dharma and does not have any central body to oversee the content of Hindu spiritual texts.
If a holy act is against the interest of other members of the society,
it should not be practiced. It is Dharma which is the source of Artha
and even of Kama.
Kurma Purana I.2.54
The implication of the Kurma Purana verse is that the hereditary caste system practiced by Hindus is an invalid system on the grounds of discrimination.