It's never a good idea to spray any kind of glue near any kind of machinery. Think of the spray as a gas - it penetrates nooks and crannies of anything within range. That will gum up the insides of your sewing machine.
Once the glue is dry, it could flake off the fabric while you're sewing, but would be more like dust. However, if you are in a very humid area and don't have air conditioning, then the glue dust might soak up some moisture.
Having said that, I've used both elmers and the basting spray and have had no problems. MY DH cleaned my HQ16 in January and it was almost immaculate inside - almost no dust. It did have some thread caught in the mechanism that lifts the needle up and down, but even that wasn't causing a problem - yet!