renounceOwnership automatically when reaching (x) amount of holders?

Hello, Do you know if it is possible to implement on the contract an automatic renounceOwnership when reaching (x) amount of holders ?

Yes you can use a counter that changes each time an address hold for the first fike the token and each time someone empty his balance. Then using a custom owner() function you check that counter. if it is > X then owner() returns 0x0000...000

As you can see, function renounceOwnership can only be called by the owner of the contract:

function renounceOwnership() public virtual onlyOwner {

So in order to emulate "an automatic renounceOwnership when reaching (x) amount of holders", you'll need to call _transferOwnership(address(0)) directly.

Luckily for you, function _transferOwnership is declared internal, which means that in your contract (which inherits from contract Ownable), you can add that call.