Deselect items from select all
Not entirely sure if this answers your question. To make an Object unselectable, you just have to toggle it in your Scene Collection. If you're asking how to deselect an object in general it's Shift + M1