No, 401k withdrawals is not 'earned income'
Your earned income for 2018 is $3000.
Normal contributions to a Roth IRA or Traditional IRA can only occur during that tax year up through the tax filing deadline (April 15) in the following year (2019). If you meant 2019 earned income is $3000, then you have until the new tax deadline of July 15, 2020 due to COVID-19.
Back to what is considered income for IRA or more specifically compensation:
Compensation for Purposes of an IRA
- wages, salary, etc.
- self employment income
- taxable alimony and separate maintenance
- non-taxable combat pay
What Isn’t Compensation?
- Earnings and profits from property, such as rental income, interest income, and dividend income.
- Pension or annuity income.
- Deferred compensation received (compensation payments postponed from a past year).
- Income from a partnership for which you don’t provide services that are a material income-producing factor.
- Conservation Reserve Program (CRP) payments reported on Schedule SE (Form 1040 or 1040-SR), line 1b.
- Any amounts (other than combat pay) you exclude from income, such as foreign earned income and housing costs.
Cashing out of a 401k would be in the same category as getting pension money so not earned income.