It sounds like you are running REPLICATE DATABASE to replicate a DB to another cluster, and you want to run code on that other cluster that creates a temp table.
The error says that you cannot create temp tables in a replica DB, which makes sense, because you cannot update a replica DB directly. It can only be updated from the replication log stream.
A possible workaround is to create a different database on the replica cluster, that is a regular, writeable database. Then put the temp table in there. You can reference the tables in your code using a two-part name like dbname.tblname
Your code can reference both the replica tables and the temp tables that way, as needed.