לֹֽא־תִטַּ֥ע לְךָ֛ אֲשֵׁרָ֖ה כׇּל־עֵ֑ץ אֵ֗צֶל מִזְבַּ֛ח יְהֹוָ֥ה אֱלֹהֶ֖יךָ אֲשֶׁ֥ר תַּעֲשֶׂה־לָּֽךְ׃
You shall not set up a sacred post — any kind of pole beside the altar of the Eternal your God that you may make.
Torah Temimah points to Sanhedrin 7b.
אמר ריש לקיש, כל המעמיד דיין שאינו הגון כאלו נוטע אשרה בישראל, שנאמר שופטים ושוטרים תתן לך וסמיך ליה לא תטע לך אשרה, אמר רב אשי, ובמקום ת״ח כאלו נטעו אצל מזבח, שנאמר אצל מזבח ה׳.
English: Reish Lakish said: Whoever appoints a judge who is not fit is as if he planted an asherah in Israel, for it is said “Judges and officers shall you appoint for yourself” and adjacent to it “You shall not plant for yourself an asherah.” Rav Ashi said: And in a place of Torah scholars it is as if he planted it beside the altar, for it is said “beside the altar of the Eternal.”
The juxtaposition of the command to appoint judges and the prohibition of the asherah is taken as a warning: an unfit judge is as destructive to Israel as an idolatrous tree.
Derash on the verse (Bavli sugya) — not a formal named middah of the 13. The adjacency of the two verses creates the comparison between an unfit judge and an asherah.
Appointing an unqualified judge is spiritually equivalent to planting an idolatrous tree in Israel; doing so near scholars is like planting it beside the altar itself.