In some cases AMP is not valid because the script tags are in the “body” part of the HTML page.
This can be caused by the third-party extension that moves “script” tags from “head” to the end of “body” part of the HTML page.
You need to set the third-party extension in a specific way, so it will not be running on Magento 2 AMP pages. These configurations can be performed in the extension’s settings or you can make minor code modifications.
For this purpose contact your third-party extension developers or our support service.