I shall present a quasi-formal translation explicating each step. I should emphasise that translation from natural language which is a source providing a wide diversity of senses to the use of each expression into formal language allows a variety of options, and in many cases, the translation is not unique. Hence, the following is only illustrative and one may rearrange, add or subtract various components with respect to the presuppositions and interpretation that one endorses.
As a preliminary analysis, I mark the relevant components with the intent of function-argument form:
Good people should be treated the way they treat other good people.
Resolve the anaphoric relations as 'they' refers to the initial 'good people' and both 'treat' refer to the same behaviour.
Taking the domain of discourse as people, accordingly, I can specify a unary relation
Good(x): x is good, and a binary relation
Treat(x, y): x treats y in a certain way.
I shall employ Hector-Neri Castañeda's deontic operator O{} (for ought, curly brackets to discern easily). Then, I proceed:
[1] Whenever an x is good and there is a y other than x, if y is good, then x treats y in a certain way:
(Good(x) ∧ y ≠ x) → (Good(y) → Treat(x, y))
[2] Whenever case [1] holds, the Treat relation symmetrically holds by moral code:
((Good(x) ∧ y ≠ x) → (Good(y) → Treat(x, y))) → O{Treat(y, x)}
[3] Case [2] holds unrestrictedly:
∀x∀y(((Good(x) ∧ y ≠ x) → (Good(y) → Treat(x, y))) → O{Treat(y, x)})
For elaboration on the deontic issues, see Harry J.Gensler's Formal Ethics (Routledge, 1996), and on the resolution of anaphoric expressions, see the article "Anaphora" by King and Lewis at https://plato.stanford.edu/entries/anaphora/.