There are two aspects to this question.
First, why did Roosevelt treat African Americans this way when they supported him? The reason for this is that he needed the support of others more. He relied on the votes of Southern Democrats in Congress to get his agendas passed. This meant that he had to allow those Democrats (who were typically white supremacist) to run the programs in the ways they wanted.
Second, why did African Americans support Roosevelt given that he allowed discrimination? Simply put, the degree to which the government was willing to help African Americans under Roosevelt was greater than it had been under the Republicans. African Americans preferred the partial help Roosevelt gave them to nothing. It is also important that Roosevelt was (with urging from his wife, Eleanor) publically much more pro-black than any previous president. For example, his appointment of Mary McLeod Bethune as the director of Negro affairs within the National Youth Administration was the first time that an African American had been named to head a governmental agency.
These factors help to explain the apparent contradiction.