If you forgot the Apple ID (iCloud) password, enter the Apple (iCloud) ID, and click Forgot Password. See if you can get a Rescue or Notification email option if necessary. Link to contact Apple Support at the end of the 2nd article.
Apple ID - Manage -
Apple ID – Forgot Password *
If necessary, boot to the Recovery Volume (command - R on a restart). Run Disk Utility/First Aid. Reformat the drive using Disk Utility/Erase. Use Mac OS Extended (Journaled), then click the Option button, and select GUID. Quit Disk Utility, then re-install the OS.
Reinstall from macOS Recovery
https://www.youtube.com/watch?v=HCrl_4k0aqo
OS X Recovery