Deductions & credits

Critter is correct.  The solar credit can offset the income tax from the 401k withdrawal, but not the penalty.

 

However, there is a waiver to the 10% penalty this year if you were affected by the COVID situation.  So the penalty might not apply.