A Massachusetts woman accused of repeatedly taking dumps in a parking lot is s**t outta luck ... she's finally in custody after essentially getting caught with her pants down.

Cops in Natick, Mass. say they've arrested 51-year-old Andrea Grocer after she allegedly made a habit of pooping outside a sporting goods store. She's being charged with 8 counts of wanton destruction of property.

Police say they started investigating the woman's alleged dirty habit in December after the store owner claimed he routinely found mounds of human feces in the parking lot.

Cops say they initially believed an animal was doing the damage, but investigators eventually found toilet paper and wipes in the area. Plus, the bowel movements were caught on surveillance footage, according to police ... but they say Grocer's license plate was always shielded from camera.

Police increased patrols in an effort to catch the serial pooper redhanded, and officers say they caught Grocer preparing to poop in the lot Wednesday morning around 7 AM.