It might be theoretically possible with enough attention, understanding, immersion, etc.
Consider that everyone has their own ways of speaking, the details of which go far beyond just grammar and vocabulary.
For example, I have a friend I met when I was two years old, and we grew up in the same city but went to different schools. In middle school, I was talking to him on the phone and handed the phone to a few friends from school (we’re all from the same city and social class), and they immediately remarked at how he sounded “exactly like me”. I wouldn’t have thought we had a distinct way of talking, and the way he talks seems pretty distinct from the way I do, to me. That’s the same native language, same city, same age, same social class, and still there are detectable differences in how people talk.
So, I think that for a non-native speaker yes there will almost surely still be qualities of the way someone talks that are distinct and may be noticeable to native ears. But what they will think it is, is another matter. Many countries have distinct regional language differences for the same language.
I know someone who moved to the USA from France in her 20’s, lived here for decades and still has a charming and distinct French accent, though she knows English completely. Once we were in Paris and she was given a hard time trying to order a simple sandwich – though Paris has a reputation for such things.
I’ve known many Europeans who spoke English so well that I wouldn’t know they were non-native speakers (though I might think they were European or Canadian).
I also know an American who just studied German in high school but learned it quite well and then went to Germany, Austria, and Switzerland (all places where German is spoken), and who was generally assumed to be a native-speaker of one of the other German-speaking countries by the native speakers who didn’t know where she was from.
Consider Arnold Schwarzenegger, who came to the United States in September 1968 at the age of 21 knowing little English. Almost 50 years later, he still has a thick Austrian accent. Then consider Nikolaj Coster-Waldau (the guy who plays Jamie Lannister on Game of Thrones) – he’s Danish and has been convincingly playing native-English speakers since Black Hawk Down (2001).
Sometimes it helps to not speak perfectly. Studying a language tends to give a more detailed knowledge of grammar than a typical native speaker has. I’ve been accused online of being a native-speaker before because I knew a language too well, and also native speakers have said I wrote in their language better than they did.
Behavior, facial expressions and body language can also strongly shape assumptions of where someone is from.
Finally, it is also possible to study linguistics and dialects and pronunciation and speaking to the point where minute differences of many kinds are well-known, and can be performed. I’ve known such people who can reproduce various dialects remarkably well.