Ola backups happening on both Primary and Secondary AG
Validate that:


Backup Priority is higher on the Secondary instances
None of the secondaries are excluded
You are looking at Synchronized (in the AG) databases
You do not have OverrideBackupPreference set in the Ola cmd line


Check your DBName. If I call sys.fn_hadr_backup_is_preferred_replica with a @DatabaseName that does not exist on the instance it returns a 1. If you have validated all this and it still returns a 1 on both replicas then the issue is not the OLA scripts, the issue is your AG configuration.



Community Wiki answer created from comments by IanG