When importing a wallet from private key or seed phrase, how do you guess the correct address format? I am building a bitcoin wallet. I can derive addresses using the derivation paths. How do I determine the derivation path for the seed when importing it?
How do I determine the derivation path for the seed when importing it?

I don't think you can determine the derivation path from the seed phrase, you have to ask the user to choose one from a list or input it if not listed. You can build in a list of derivation paths for popular wallets, the user then has to know the name, and maybe version number, of the wallet that produced the seed they are importing.

or do i just do a wallet address lookup based on the supported derivation paths and keep searching for about 20 address if it has any transactions on the blockchain ?

That would work in many cases. It assumes you have access to a full copy of the blockchain indexed by all addresses with non-zero balance. It needn't be local but a non-local source might make your seed-importation take a long time.