simply hold in a cash account, not a margin account. easy peasy.
If the stock is in your name (registered directly to you) the exchange cannot lend them out. Unless you do that, the stock remains in the “street name” and the exchange can lend them out as they please.
If you haven’t taken that step, (and you would know it), it remains in the control of the exchange.
This has nothing to do with being in a margin account.