A new roof doesn't qualify for a tax deduction or credit, but the cost could be added to the basis of your home.
In general, expenses to upgrade or replace a roof to prepare for solar panel installation and related equipment don't qualify for the Residential Clean Energy Credit. However, there are certain types of solar roofing equipment like solar roofing tiles and shingles that might qualify for a credit.
You may qualify for energy tax credits if you make renewable energy upgrades or energy-efficient improvements to your home, like solar or geothermal equipment.
Please see the link below for improvements that qualify for the Energy Tax Credit
The energy credit is a non-refundable credit, which means it is limited up to your tax liability. If you “qualify” for the credit, it doesn’t mean you will receive the full credit as a refund, but it might make some impact in any refund you might receive. If you don't receive the full amount of eligible credit, you can carry forward any remaining of the credit toward future years.
You can also visit the Energy Star website to see which appliances, equipment, or materials qualify for the credit.