Go to Apple Store or other place which can check and replace it under replacement program.
It’s a common rattle, which cannot be fixed by you.
See Rattlegate thread in Macrumors.
Personally I had this issue with Noise Cancelling enabled - it was replaced in like 3 days after I left them for checks in Poland (we don’t have official Apple Store, only Retailers)
Learn how to get service for your AirPods. We can troubleshoot the issue or help you arrange a repair or replacement. Find out the costs and service options near you.
I took my launch day AirPods Pro in last week. The first genius ran a diagnostic on his iPad and said "everything passed." He then sent them to the back for a tech to run more tests, they failed.
They replaced the left and right (only the left was rattling, the right one had intermittent tinny issues).