Generally you can parse the b64 to bytes and marshal it into a SignedTransaction object then run an ed25519 verify against the pubkey, signature, and mspgacked txn bytes.
To complement @Ben’s response, it depends what you mean by “valid transaction”.
You can verify the signature is valid.
But it does not mean the transaction would be accepted by the blockchain.
There are many other restrictions that may make the transaction rejected by the blockchain, such as (this list is not exhaustive):
the sender account was rekeyed
the sender account does not have enough Algos / ASAs
in case of ASA transfer, the receiver account did not opt in; in case of payment, the receiver account is empty and the amount is below 0.1 Algo
the transaction is an application call for an invalid application ID / the application ID was destroyed
the transaction is not valid for other reasons: for example a key registration without Falcon keys