TT #610 · Parashas Ki Seitzei · Seventh Aliyah · Passuk 25:01
When there is a dispute between men and they come to judgment, and they judge them, and they declare the righteous one righteous and the wicked one wicked,
Torah Temimah points to Sifrei Devarim 286 / Sanhedrin.
TT lemma: כִּי יִהְיֶה רִיב בֵּין אֲנָשִׁים.
Sefaria — Sifrei Devarim 286 / Sanhedrin
English: ‘When there is a dispute between men’ – come and learn from the dispute.
Derash introducing the judicial setting (Sifrei) — lashes are discussed only after a proper court process.
The laws that follow (including the limit of lashes) presuppose that the parties have come to court and received a formal judgment.