Business & farm

You need to have income.   Which is a Net Profit on Schedule C for self employment.  You can contribute to a 401K up to the amount of your Net Profit reduced by 1/2 of the SE tax OR to the max contribution allowed for a 401k whichever is Less.  @dmertz