Dhoti or Lungi is a cultural dress and there is nothing wrong in wearing it, and one can pray salah if it is not transparent.
If Dhoti or Lungi or any dress is transparent, tight, has any an image or Shirk, Kufr, Bidah,Haram or Fahshah (abusive, immoral or unethical words or sentences) written on it then wearing it is Haraam (Forbidden & Sinful) in Islam.