No, the $3,000 long-term capital gain from selling stock cannot be directly deducted from the $4,000 spent on rental house repairs.
These two items are treated separately on your tax return:
While you can’t directly offset the repair expenses with the capital gains, both will affect your overall taxable income. The repair expenses will reduce your rental income, and the capital gains will be taxed at the applicable long-term capital gains rate.
@mxu1 Thanks for the question!!