"to the Cohanim, the Levites": It is a mitzvah that there be Cohanim and Levites in the beth-din.
I might think that if there are none, it is invalidated; it is, therefore, written "and to the judge": Though there be no Cohanim or Levites, it is a bona fide beth-din.
"and to the judge that shall be in those days": Now would it enter your mind that one should go to a judge who is not in his days?! (The reference is to) one who was related (to the judge by marriage), and whose relationship was subsequently dissolved, in which instance he may be judged (in "those days" following the dissolution of the relationship). Variantly: Do not say (I must have a judge) like Moses and Aaron, but (go to) "the judge that shall be in those days." As it is written (Koheleth 7:10) "Do not say: 'What has happened that the earlier days were better than these?' For it is not from wisdom that you ask this."