Whether the issue lies with a lost iPad Passcode, or an unknown AppleID Password, you’ll ultimately encounter exactly the same outcome...
The iPad will at some point need to be “restored” which will result in all locally stored Apps and data being erased from the iPad. Next you’ll likely encounter an Activation Lock; without the correct AppleID credentials, you’ll not be able to recover use of the iPad.
In summary, your non-transferable software is now lost - as is use of the iPad.
Here are the Apple support pages that outline the Activation Lock - and the only mechanisms by which it can be turned off:
Activation Lock for iPhone, iPad, and iPod touch - Apple Support
Turn off Activation Lock – Apple Support
As you will discover, unless you are the owner of the AppleID that was last used to activate the device, or unless you can secure the cooperation of the previous owner, you’ll not be able to defeat or bypass the Activation Lock. Without documentary evidence that you are the original owner (such as sales receipt showing the serial number), Apple won’t assist - and nobody here will be able to help you.
The All Too Common SAD Reality of Buying … - Apple Community