I have mud on my pants but it does not get off even after washing. These are just stains. Is this considered najs and can I be able to pray salah wearing these pants?
If you can't get this off even by washing, you have done enough effort to clean your pants! And therefore you can consider it as tahir!
The majority of scholars from the Maliki, Shafi'i and Hanbali school consider a tissue tahir if it was not possible to wash off the color of a najassa. As the color of a najassa is considered a one of the three parts or attribute of it (color, taste, odor): Based on the hadith:
Abu Hurairah reported that Khawlah daughter of Yasar came to the Prophet (ﷺ) and said: Messenger of Allah, I have only one clothe and I menstruate in it, how should I do ? He said: When you are purified, wash it and pray in it. She asked: If the blood is not removed, (then what) ? He said: It is enough for you to wash the blood, its mark will not do any harm to you. (sunan abi Dawod)
The Hanafis make a distinction whether it is difficult to wash off the color or not, but the strongest opinion in their madhab is still the same as the majority!
Note that ritual purity only needs water to clean a tissue (with a few exceptions based on different madhab views), some scholars however recommend using soap.
For details read this Arabic fatwa islamweb #258265.