Stephen Colbert testified in Congress on Friday about an immigration bill that he said — in all truthiness — he had not read, “like most members of Congress.”

And when the comedian was challenged by one disgruntled lawmaker about his expertise, which was based on a single day spent hamming it up in a bean field for his show on Comedy Central, Mr. Colbert, keeping completely in character, said that was enough time to make him an expert on anything.

Mr. Colbert testified before the House immigration subcommittee about the day he recently spent picking vegetables on a farm in upstate New York. The gig was part of the “Take Our Jobs” campaign by the United Farm Workers of America to highlight the work done by migrant workers.

Arturo S. Rodriguez, the president of U.F.W., testified among others alongside Mr. Colbert.

Before Mr. Colbert bounded into the unusually packed committee room, the buzz in the crowd was whether Mr. Colbert would show up as the satiric Stephen Colbert, who hosts the “The Colbert Report.” He did.

Representative Zoe Lofgren, a California Democrat and the panel’s chairwoman who invited Mr. Colbert to testify, opened on a slightly wry note.

“We realize there is great interest in the plight of migrant farm workers in America,” Ms. Lofgren said, before asking the press to pull back from the witness table where Mr. Colbert was mugging for and winking at the cameras.

Representative John Conyers, a Michigan Democrat, seemingly miffed, suggested that Mr. Colbert “excuse yourself” from speaking. Looking baffled, Mr. Colbert said he did not understand the question, and threw himself on the mercy of the chairwoman, who allowed that he should stay.

On the whole, the mood of the hearing alternated between the serious and the absurd. (His spoken testimony departed significantly from his prepared text, which was straightforward and earnest.)

“I certainly hope that my star power can pump this hearing all the way up to C-Span 1,” Mr. Colbert said, before explaining that the “obvious answer is for all of us to stop eating fruits and vegetables — and if you look at the recent obesity statistics you’ll see that many Americans have already started.”

But, he continued, his gastroenterologist had explained to him that fruits and vegetables are an important source of “roughage” and said that he “would like to submit a video of my colonoscopy into The Congressional Record.”

“I don’t want a tomato picked by a Mexican — I want it picked by an American, then sliced by a Guatemalan, and served by a Venezuelan in a spa where a Chilean gives me a Brazilian,” Mr. Colbert said, before turning just perceptibly more serious and talking about how difficult work as a farm worker was.

“After working with these men and women, picking beans, packing corn, for hours on end, side by side, in the unforgiving sun, I have to say and I do mean this sincerely: Please don’t make me do this again, it is really, really hard,” he said.

“The point is, we have to do something because I am not going back out there. At this point, I break into a cold sweat at the sight of a salad bar,” he said.

Five minutes later, much to the disappointment of the crowd, Mr. Colbert was done. “U.S.A. No. 1,” he said to wrap up his testimony.

Mr. Colbert had only a supporting role in the question-and-answer segment of the hearing, although Representative Lamar Smith did go back and forth with the comedian. The Texas Republican asked the comedian for particulars — if Mr. Colbert knew if the roughly 100 workers he worked alongside with were illegal immigrants and whether he knew their salary. Mr. Colbert could not provide this information.

“Does one day in the field make you an expert witness?” Mr. Smith pressed.

“I believe that one day of me studying anything makes me an expert,” Mr. Colbert replied.

Not everyone was amused. Representative Steve King, Republican of Iowa, declared in his opening statement that it was an insult to the troops at war to suggest that Americans don’t like hard jobs.

“Maybe we should be spending less time watching Comedy Central and more time considering all the real jobs that are out there,” he said.

Near the end of the hearing, Mr. Colbert turned sincere, giving a serious answer when asked a serious question by Representative Judy Chu, Democrat of California, about why he had chosen to donate his time to the plight of migrant farm workers out of all possible causes.

Drew Angerer/The New York Times

Mr. Colbert paused, scratched the back of his head and sounding almost surprised at himself replied, “I like talking about people who don’t have any power, and it seems like one of the least powerful people in the United States are migrant workers who come and do our work but don’t have any rights themselves,” he said. “Migrant workers suffer and have no rights.”

This is not the comedian’s first foray into politics. In 2007, Mr. Colbert paid the $2,500 fee and filed papers with the South Carolina Democratic Party to run for president in his home state’s primary. He was rejected just hours later by the state’s executive council.

And in October, Mr. Colbert will return to Washington with fellow Comedy Central host, Jon Stewart, for rallies on the National Mall. Mr. Colbert will headline the “March to Keep Fear Alive” while Mr. Stewart will lead the “Rally to Restore Sanity,” but both are intended as a spoof of conservative radio and television personality Glenn Beck’s “ Restoring Honor” rally in late August.

(C-Span has posted the entire hearing.)