Yes, it’ll be fine but with caveats. Make sure you get the M7100 crankset which has a 52mm chainline.
I’ve got SLX M7100 crank set with a 10 speed MTB setup & 10 speed chain, and it works fine. Narrow/wide chainring together with clutch on derailleur and I’ve never had the chain come off, admittedly I don’t ride aggressively.
The differences on Shimano 12 speed are that the chain has slightly longer internal plates and the 12 speed chainring, derailleur & cassettes are designed to accommodate the 12 speed specific chain. So, using a 10 speed chain like I’m doing means the 10 speed chain doesn’t fit the chainring perfectly possibly causing premature wear. Using a 12-speed chain on a 10/11 speed cassette/derailleur means that the chain is bit too tight on the cassette/derailleur, again possibly causing premature wear.
On as side note, using a 12 speed Shimano chain on a worn 10/11 speed drivetrain might be good idea as the extended internal plates will fit better on a worn drivetrain.