Though this poem is specifically set in Harlem, which is part of New York City, it doesn't stay in Harlem. Instead, the setting expands to include several places, reminding us that the issues confronted by this poem are ones that affect all of America, and perhaps, the world.
Of course, we start out in a familiar setting—a classroom. Our speaker is taking an assignment from his instructor. Right away, the setting lets us know a few things: education is a focus here, and so is power. The speaker is a student, and so he is motivated to learn (or, at least, he should be!). At the same time, he's got instructions to follow. The instructor is the one in charge, and the speaker must oblige him by fulfilling the task that's been set forth for him.
In following those instructions, the speaker takes us on a quick trip down to the South, where he was raised in North Carolina, land of the pines and, as a part of the South, the assumed home to way more racism than there is in Harlem. This setting flashback, then, reminds us that issues of race would have been prevalent in the speaker's life from the very beginning.
After we've moved on back to the present, the setting shifts back, too. We get a little scenic walk through Harlem away from what we can figure out to be City College. The speaker is now putting himself (and us along with him) directly into the hustle and bustle of a major metropolis, a hubbub of humanity that—for all of the people—still had some strict divisions to it (at the time the poem was written, Harlem was considered the province of black and Hispanic New Yorkers, and to a degree still is today). So, the setting switch tells us that some things have changed for our speaker from the South, but that some things have remained the same.
Finally, our speaker reaches a more specific setting: his room at the YMCA. We're guessing that this room in the Y is nothing fancy, so again the setting is revealing something to us: the speaker's economic situation. Really, just by following him around from one setting to the next—from the South, to Harlem, to his room at the Y—we learn a great deal about the speaker's life. In short, he's on the margins of a racist society—on the outside looking in, even while he sits in a college classroom.
And so, the setting in this poem is a vivid backdrop to the drama going on in our speaker's mind. Wrapped up in his quest to find out who he is as a 22-year-old black man, is another quest, a quest that involves the setting. What exactly is Harlem? What's New York? What's America? And how do I, the speaker asks, and all these people, so different from me, fit into this big country together?