To remove all the cached packages that are not currently installed, and the unused sync database, execute (as sudo) Note the warning about doing this in the wiki.
pacman -Sc
https://wiki.archlinux.org/title/pacman#Cleaning_the_package_cache
And have a look here for clearing the pamac
(Add/Remove Software) cache: