Yes you can apply through the lottery. You will have to download the forms from the USCIS website. The lottery occurs during one month each year and that month is not announced in advance so you have to keep checking. The form will tell you what information to list. You have to do everything exactly as indicated or your application will be discarded. There are a limited number of green cards available through the lottery and a quota imposed on each country. Your chance of winning varies depending on which country you come from.Ask a similar question
Talk to a lawyer about your case before doing anything - in part to clarify your question. I agree that if you are here in valid F-1 visa status, you can in most cases legally apply for the lottery (if this is what you were asking) - but there may in some instances be risks and/or consequences to doing this concerning travel and in some cases there might be issues concerning the timing of your most recent entry. If you were asking if you can use the lottery to apply for an F-1, then you can't.
We're actually in the lottery period right now - October 2 to December 1 - and you need to submit the application online if you want to do apply for a green card this way. Use the link I've attached for instructions and links to the online forms.
An F-1 is a strictly "nonimmigrant intent" visa - you need to have the intent to stay only temporarily, and can't also have the intent to eventually want to stay in the U.S. permanent (dual intent visas like the H-1B and L-1 do allow this). Once you apply, you have given some indication of an intent to eventually seek permanent residence.
This generally isn't much of a problem if you don't win, as this normally isn't viewed as sufficient to establish immigrant intent and the consulates are not notified in any event. If you do win and eventually adjust status, you would then have a green card and the F-1 would no longer be an issue.
The risk would be in winning, completing paperwork, but yet not getting the green card - either because of an issue with your case or simply USCIS failure to process an Adjustment of Status case in time. If this happens, you could have difficulty getting any future F-1 visa stamp (or one for any other nonimmigrant intent visa). So, a lawyer should look at your case to at least make sure there are no huge issues that might cause a problem (or determine if solutions are available).
There might be an issue of you use the F-1 to enter the U.S. very recently before the lottery filing, as well - so this, too should be vetted by a lawyer.Ask a similar question