Romans 3.28 says: “For we hold that one is justified by faith apart from works of the law.” Galatians 2.16 says: “… we know that a person is not justified by works of the law but through faith in Jesus Christ, so we also have believed in Christ Jesus, in order to be justified by faith in Christ and not by works of the law, because by works of the law no one will be justified.” Titus 3.5-7 says: “… he saved us, not because of works done by us in righteousness, but according to his own mercy, by the washing of regeneration and renewal of the Holy Spirit,whom he poured out on us richly through Jesus Christ our Saviour, so that being justified by his grace we might become heirs according to the hope of eternal life. The saying is trustworthy, and I want you to insist on these things, so that those who have believed in God may be careful to devote themselves to good works.” Ephesians 2.8-10 says: “For by grace you have been saved through faith. And this is not your own doing; it is the gift of God, not a result of works, so that no one may boast. For we are his workmanship, created in Christ Jesus for good works, which God prepared beforehand, that we should walk in them.”
The thing that does not cause justification in Romans 3.28 and Galatians 2.16 is “works of the law” i.e. performance of the Mosaic law. The thing that does not cause salvation in Titus 3.5-7 is “works done by us in righteousness” i.e. “good works”. The thing that does not cause salvation in Ephesians 2.8-10 is “works” that “one may boast” (charitable or heroic deeds) i.e. “good works”. Baptism is not in view in all these passages.
Baptism is not even a work; much less works that one may boast i.e. good works. When you are baptised, you are passive. God forgives your sin and confer on you a sign of covenant through baptism. It is all God’s doing; you do nothing.