''lightmap index'' keeps chhanging even if ''lock atlas'' is checked

I want to have control on how to group my meshes in different lightmaps, I would choose a mesh and set it`s ‘‘lightmap index’’ to 2 for example, bur after I bake selected it gets reset to ‘‘3’’. Is that a bug in Unity?

Sort of - it’s because you’re using Bake Selected. I remember running into this a while ago, raising it with the devs, and IIRC they said that they can’t make Bake Selected work with Lock Atlas or something.