How do I use the add_query_arg function in a template tag like previous_post_link?

previous_post_link and its sibling are pretty simple functions, so there’s not a lot to play with if you really want to use these (if you’re building a plugin and do not want to touch the theme, making you need a filter which isn’t there).

However, since you’re talking about templates, I’m guessing that you’re building a theme. That gives you another option, namely building your own previous/next post link. The instrument for this is get_adjacent_post.

That function will simply give you the previous/next post as an object, leaving you all posibilities to change the permalink with add_query_arg and then build your html around it.