So, your use case would violate the Bluetooth specification.
Furthermore, when you look at the Bluetooth architecture you can see that there is a interface called the HCI (Host Controller Interface) that separates the stack into two parts. This can be two physical chips but is also used as pure logical interface when the entire BLE stack is on one chip. The ArduinoBLE library at the lowest level talks trough the HCI to the BLE controller. HCI has a function to read the BD_ADDR (HCI_Read_BD_ADDR) but there is no function to set it to a value chosen by you. You can find the function in the HCI.cpp file.
int HCIClass::readBdAddr(uint8_t addr)
There are ways to allow the BLE controller to generate a random address but that would not create the same address on two different chips. This is used to prevent tracking of BLE devices e.g., by all modern smartphones by changing the address in a random interval. I do not know whether this function is implemented in the ArduinoBLE library. You would have to look trough the low level part of the library.
Can you describe your use case in a bit more detail? Maybe we can come up with an alternative solution.
Thanks Klaus for your detailed response, that's really helpful.
I'm collecting data for a research project that is trying to demonstrate that it is possible to identify the piece of hardware that transmitted a bluetooth packet even if the packets are identical (or contain no fixed identifying data).
We are intercepting the data using a software defined radio and feeding the raw signal to a deep learning model.
Of course having a fixed mac address makes the problem trivial for the model to identify the device.
However, if it's not possible to explicitly set the address, randomly changing the address for each packet would have the same effect (the AI wouldn't be able to rely on simply reading the address).