The stem has about 8 inches without leaves. When I repot can I have this bare stem in the soil or would the stem rot.
Stems will rot with heavy soil that retain moisture, it would be possible to bury most plants in loose dry mulch and it would grow out of it. But if the soil was a heavy clay and wet, the plant could perish due to rot. So it really depends. Considering avocado seedlings love loose well drained soil, one could assume that is what you are using for your potting mix
Avocado seedlings have soft, pliable, and often hollow stems which only need a sharp stone to penetrate the outer layer to render them vulnerable to disease. This risk is even higher if the young wood is buried. It is possible to air layer avocado trees so they will develop roots along the stems but when air layering we use a rooting material that is a lot more airy than regular soil for roots. Given your situation with a very young seedling where you would like to eliminate the bare section you are probably further ahead to just cut the stem back to a node and let it sprout out at the new chosen height.