WASHINGTON — As a political appointee at the Department of Housing and Urban Development, Lynne Patton has become one of the most prominent African-American officials in the Trump administration, and it was the color of her skin and her relationship with President Trump that led to her appearance during Michael D. Cohen’s congressional testimony on Wednesday.

[Update: Trump names Mark Meadows chief of staff, ousting Mick Mulvaney.]

Before getting her job at HUD, Ms. Patton was an event planner in New York, and worked for the Trump Organization and for the Eric Trump Foundation. Anticipating Mr. Cohen’s accusation that President Trump was a racist, Representative Mark Meadows, Republican of North Carolina, invited Ms. Patton to appear as a rebuttal to the charge.

“You made some very demeaning comments about the president that Ms. Patton doesn’t agree with,” Mr. Meadows said, after Mr. Cohen called his former boss a racist and noted that, among other comments, “he told me that black people would never vote for him because they were too stupid.”

As Ms. Patton, 46, stood silently behind him, Mr. Meadows argued that Ms. Patton’s loyalty to Mr. Trump proved that could not be true.