"If any man's wife goes astray...[and commits a sacrilege/trespass/treachery/ma'al against him (by having carnal relations with another man)]" (Num. 5:12) He asks: What is the connection between the two [sections of the Torah, this one discussing the “Sota”/suspected adulteress and the previous one discussing Temple sacrilege]? It is written [Above:] "To do a sacrilege/treachery/ma'al against G‑d" (Ibid. 5:6) and it [sacrilege] is written [also] here.1 Rabbi Eleazar [who wants to point out that there is actual defrauding of G‑d] quoted the verse, "If Any man's; [lit.] 'man man's....wife strays and betrays him'" Why does the verse use [the word man] twice, when once would have sufficed? That was already explained [that one 'man' is G‑d and the other is the husband (see Rashi on this verse) but another explanation is] that "man man" means a man who is a man [a man who controls his inner “man”, not indulging his lust after other women] that is, who fulfills the words "Drink water [meaning to have relations] out of your own cistern" [your wife and not a another woman]. (Prov. 5:15) Such is a [righteous] man ["Ish"/man connotes a righteous man] in the world, a man to his [own] wife. [The Sages said that the waters of the “Sota” only are effective if the husband is faithful.]

It refers to one trespass Above and one below...

"...And trespassed a trespass against him." (Ibid.) One "trespass" would have sufficed; why does the verse say it twice? It refers to one trespass Above and one below, one against the Congregation of Israel [malchut, the root of the souls of the women of Israel], and one against Her Husband [Zeir Anpin]. Therefore, "then shall the man bring his wife [to the kohen]." (Ibid. 5:15)

Why "to the priest" [and not to the judge]? The secret of it is that the priest is the attendant of the Matron [malchut, and he brings her to Zeir Anpin to cause union between them in both the physical and spiritual realms]. [In order to understand why a priest, who represents chesed, has to do the action causing judgment to befall the adulteress] we have to examine the verse which says: "And he shall kill the bullock," (Lev. 1:5) [for if the priest is of chesed, why would he be the doer of judgment]? "He" refers to someone other than the priest. A priest is forbidden to arouse judgment, in order not to impair the source[of chesed] to which he is connected. [Therefore the slaughter of an animal offering is also allowed by a non priest.] Yet you say that the man should bring his wife to the priest to judge her trial [counter to kindness]!

It must be that only the priest is suitable for this task, because he is the attendant of the Matron
[malchut], and all the women in the world are blessed from the Congregation of Israel [malchut, who is blessed from Zeir Anpin]. Therefore, the woman below is blessed with seven blessings [at her wedding] since she is connected to the Congregation of Israel [malchut which has in it all 7 sefirot]. The priest has to arrange the things of the Matron and see to all her needs [whether to draw down Divine flow upon Her or “adorn” Her for her Husband]. Therefore, only the priest is suitable for this [to fix the blemish in malchut] and no other.

It is only to try to increase peace in the world and enhance chesed...

You might say that he is carrying out judgment [on the Sota]. It is not so! It is only to try to increase peace in the world and enhance chesed that he strives to do. If the wife is cleared of the accusation, the priest increases peace between them [by removing the husband's suspicions], and not only that but she will also conceive a son. Peace is achieved through him. If she is not cleared in her trial [and purified], it is not the priest who passes judgment, but rather the Holy Name, to which she was false, passes her judgment and tests her.

Come and see! The priest did not get involved here, except at the time she caused herself to be presented to him, in order that she would be acquitted. He questions her once and again [and tells her not to risk the trial if she is indeed guilty] and [it is only] if she wishes to clarify her innocence, only then does he take action to promote peace [between her and her husband].

[This is how the priest performs the ceremony:]The priest writes [in the Sotah's scroll] the Holy Name [in verse Numbers 5:21] the regular way, and then [in the second part of that verse] backwards. The letters were empowered by their spiritual lights: judgment with judgment [Havayah in reverse is judgment], mercy with mercy [Havayah in regular way is mercy, and to make it clear that it is] mercy [acting] with [the approval of] judgment [and] judgment [tempered] with mercy. If she is cleared, the letters of mercy remain [in the regular order] and of judgment are gone. If she is not found worthy, the letters of mercy disappear and the letters of judgment remain [in reverse]. And then her sentence is carried out.

BeRahamim LeHayyim:
The Sotah woman suspected of adultery is given the opportunity to prove her husband wrong by drinking a mystical potion that contains G‑d's Name. The Torah Above concerns the erasure of G‑d's Name. The Zohar reveals that G‑d's Name was written twice—regularly and in reverse. If the letters —in their correct order, related to kindness, remained after being put into the liquid mixture, it meant that the husband's suspicion was mistaken. But, if on the contrary, the letters written in reverse remained—relating to judgment— that meant that she was indeed guilty.

It never ceases to amaze how strictures of Jewish law may be modified to promote peace between two Jews, here husband and wife. For here the Torah permits G‑d's Name to be blotted out to be able to prove either (1) the wife was innocent or (2) the wife was guilty. If G‑d's Name represents His essence, the destruction of His Name would appear to be the greatest desecration imaginable. Yet, for the sake of peace between husband and wife, this is permitted. G‑d's Name remains the main judge, and the order of the letters that survive the immersion into the sacred solution testify to the guilt or innocence.

[Bracketed annotations from Metok Midevash and Sulam commentaries]