The method is the same, but the materials are different. Can I apply for a patent?

Yes, you can apply from several aspects.

1 your preparation method (however, your method must be changed, and your changes can have a beneficial impact on the preparation of material b, such as reducing costs and simplifying steps. )

Because the two materials A and B are different, there must be changes in physical or chemical properties. You can find different places and apply through this.