The ideal way to protect wood from rotting in the soil is to apply arsenic and chromium-free wood preservatives. An example of this preservative is aqueous copper naphthenate. A great way to prevent rotting and deterioration of wooden parts in contact with the ground is to use concrete to secure them. Not only does this ensure that your posts and other wood applications in contact with the ground are protected from rotting and decay, but it ensures that your workpieces stay strong for years to come.
At a minimum, use a wooden stamp with UC4, if you are going to be buried. Then you'll know it's treated for ground contact. For a Barrettine Premier Wood Preserver color preservative followed by a clear oil such as Barrettine log cabin treatment.
I'll coverwhich level of pressure-treated wood is the most resistant to water and fungus, as well as ways to protect buried wood.
Your best bet is a good quality conservator, such as the Premier Wood Preserver, you can apply three liberal coats of this to your beams and it will last a few years as I suspect they will be mostly covered. Therefore, fill a bucket with enough wood preservative to cover the necessary parts of the wood or use the sprayer to spray the wood parts with the preservative. It is relatively easy to defend against rot, but once it settles it can be almost impossible to remedy, so it is of the utmost importance to protect the wood by preparing it properly before placing it on the ground.