How to divorce the Greencard marriage

The best way to handle this is by way of an annulment as opposed to a divorce. You can ask the court to annul the marriage due “concealment of a material fact” or “fraud.”
The procedure would then be similar to any other annulment or divorce action. You would prepare the summons and complaint, serve the spouse, and if contested, have a hearing where you present your evidence.
It is best to have an independent third party to corroborate your claims.  You would have to prove that at the time your spouse married you, all they wanted was a greencard yet they led you to believe they wanted to be married to your for love. You would have to show that you relied on this assertion that the marriage was about love, and that had you known it was just for a greencard you would not have entered into the marriage.
If the marriage is under two years old at the time you discover the fraud, and your spouse only has a conditional green card, it is possible that you can prevent your spouse from getting a permanent greencard by refusing to attend the follow up interview with USCIS and by stating on the record that the marriage was annulled due to fraud.