Dinesh D’Souza, a best-selling conservative author and filmmaker, was indicted on Thursday on charges that he used straw donors to illegally donate to a 2012 Senate campaign.

Mr. D’Souza is an outspoken political commentator who directed “2016: Obama’s America,” a scathing anti-Obama documentary released in the final months of the president’s re-election campaign.

Federal prosecutors in Manhattan said that Mr. D’Souza encouraged others to give $20,000 to a Senate candidate and reimbursed them for the donations. Election law prohibits such arrangements and caps donations at $5,000 per donor to any one candidate.

The Senate candidate was not identified in the indictment. Mr. D’Souza donated to only one federal candidate in 2012, giving $5,000 to Wendy Long, a New York Republican who lost her challenge to Senator Kirsten E. Gillibrand, a Democrat.