Yes you can. Using some kind of liner in the air fryer can help just in case your marshmallows move around when cooking. The less mess, the less cleaning.  Use it in the air fryer basket ONLY. Do not use it under the basket and place it in when you are immediately putting food on top of it afterwards.