Do I need a job offer to apply for OPT?
No. Post-completion OPT needs no job offer to file, though you must find qualifying work within 90 days of your start date.
No. You do not need a job offer to apply for pre-completion or post-completion OPT. The rule at 8 CFR 214.2(f)(10)(ii)(A) asks for a DSO recommendation, Form I-765 and the filing fee, not an employer. The job comes afterwards, and the clock that matters is the unemployment limit, not the application.
What you do need to apply
Your DSO enters the OPT recommendation in SEVIS and issues a new I-20. You then file Form I-765 with USCIS, within 30 days of the DSO's recommendation, and no earlier than 90 days before your program end date or later than 60 days after it. The application asks for the requested start date and the end date, and you pick them within those limits.
None of that involves an employer. You do not name one on the I-765 for regular OPT, and USCIS does not check whether you have one.
The 90-day limit is where the job matters
Once the EAD start date arrives, every day without employment counts as unemployment. Post-completion OPT allows a maximum of 90 days of unemployment in total. Days are counted from the start date on the EAD, not from the day the card arrives, and the card often arrives weeks into the period. A student whose card is approved on day 40 of an unemployed stretch has already used 40 of the 90.
Work has to be directly related to your major field of study, at any level of the job. Part-time work of at least 20 hours a week counts as employment for the unemployment tally. Fewer than 20 hours a week does not. Volunteer work, unpaid internships in the field and self-employment can also count when they meet SEVP's conditions, which are in the SEVP guidance and not always obvious. Ask the DSO before assuming a gig qualifies.
Where an employer does come in
The STEM OPT extension changes this. A STEM extension requires a job with an E-Verify employer, a signed Form I-983 training plan and a paid position. Someone planning to extend should be choosing their first-year job knowing that.
A common mistake
Students sometimes delay filing because they lack an offer, then file near the 60-day limit and lose the starting weeks to processing. Delay doesn't help. The 90-day clock begins on the EAD start date you chose, so choose a date you can plausibly meet, but file as early as the window allows.
Who this does not cover
Curricular Practical Training works differently and does need an employer, with the employer's offer and a DSO authorization before work begins. This answer is about OPT only.
A student who has already used unemployment days and is unsure of the tally should ask their DSO to read the SEVIS count back to them. Students facing a termination notice or a gap close to the limit may want to talk to an immigration attorney.