Is there a way to post as an arbitrary user when creating a new post/topic using the Discourse API?

What API key are you using? The system-level one should, I believe, allow you to impersonate any other user via the api_username query parameter.