Devarim13:5

אַחֲרֵי יְהוָה אֱלֹהֵיכֶם תֵּלֵכוּ וְאֹתוֹ תִירָאוּ וְאֶת־מִצְוֺתָיו תִּשְׁמֹרוּ וּבְקֹלוֹ תִשְׁמָעוּ וְאֹתוֹ תַעֲבֹדוּ וּבוֹ תִדְבָּקוּן׃

After the Eternal your Almighty you shall walk, and Him you shall fear, and His commandments you shall keep, and to His voice you shall listen, and Him you shall serve, and to Him you shall cleave.

Devarim 13:5

אַחֲרֵי יְהוָה אֱלֹהֵיכֶם

Devarim / Deuteronomy 13:5 · Sod

Devarim 13:5

אַחֲרֵי יְהוָה אֱלֹהֵיכֶם תֵּלֵכוּ וְאֹתוֹ תִירָאוּ וְאֶת־מִצְוֺתָיו תִּשְׁמֹרוּ וּבְקֹלוֹ תִשְׁמָעוּ וְאֹתוֹ תַעֲבֹדוּ וּבוֹ תִדְבָּקוּן׃

After the Eternal your Almighty you shall walk, and Him you shall fear, and His commandments you shall keep, and to His voice you shall listen, and Him you shall serve, and to Him you shall cleave.

Sod סוֹד

Inside the attributes

One person is kind but cannot say "no". Another is strict but cannot pity. The Ba'al Shem Tov teaches how to cleave to the Eternal so that both unite within you.

Ba'al Shem Tov: the sages said "cleave in His attributes" (בְּמִדּוֹתָיו), not "to His attributes" (לְמִדּוֹתָיו). The main service is to cleave to the inner, to the life of the attributes, not to their outside. Outside, the attributes are separate: where there is kindness (חֶסֶד), there is no strictness (גְּבוּרָה). But inside all is one, for the life of each attribute is the Infinite, and kindness contains strictness and strictness contains kindness.

How Ba'al Shem Tov explain it

Ba'al Shem Tov

The Ba'al Shem Tov said, explaining the Gemara (see the Gemara, Sotah 14a): "cleave in His attributes" (בְּמִדּוֹתָיו), and they did not say "to His attributes" (לְמִדּוֹתָיו). For the main service is that a person cleave to the inner, which is the life of the attributes, and not cleave to the outside of the attributes.

For if he cleaves, for example, to the attribute of kindness (חֶסֶד) on the outside, then he is not cleaving to strictness (גְּבוּרָה), because on the outside they are separate: if it is kindness, it is not strictness. But on the inside it is written: "I, the Eternal, have not changed" (Malachi 3:6), and everything is included.

So a person who wishes to serve the Eternal must cleave to the inner, the life of the attributes, where all the attributes are included, for the life is the Infinite, blessed is He. And then strictness is included in kindness, and likewise kindness is included in strictness. (See above in the portion of Shemot, note 3.)

Takeaway

The prefixes בְּ ("in") and לְ ("to") differ by one letter. To cleave "to" (לְ) the attributes is to imitate them from outside, to cleave "in" (בְּ) them is to enter within, where they live. The Ba'al Shem Tov builds his lesson on this one letter.
Attributes (מִדּוֹת) are the ways the Eternal acts in the world: kindness (חֶסֶד), strictness (גְּבוּרָה) and others.
This is the same teaching of the sages that Ein Yaakov brings on this page: "walk after His attributes", clothe the naked and visit the sick (Sotah 14a). The Ba'al Shem Tov explains how to do it from within.