If I (a non-US citizen) were to fly to Washington DC and state my reason for visit as “attending an anti-war demonstration,” will I be denied entry? Is there a specific rule regarding this, or is it up to the officer? This is purely a hypothetical question, I’m just curious.
It is totally up to the discretion of the INS guy and you can be denied entry without having to state any reason but I suspect in this case chances are good that you would be denied entry.
I think you would just state “vacation” if you really wanted to attend the demonstration…
Yeah, it’s best not to get people’s panties in a twist over such a thing. Just say you’re a tourist.
What Violet and friedo said. If you’re really serious, I don’t think lying to a gov’t official is going to cause you lost sleep. Otoh, telling him the truth might cause you a number of sleepless nights.
Do the right thing! Lie! 
Why do people insist in answering the question which wasn’t asked? Any fool knows not to say that when they try to enter the USA. The OP said he has no intention of entering with the purpose of participating in a demonstration. He wants to know what the rules are regarding such scenario. That is his question. I am sure he has enough imagination to know you can lie about it but he wants to know what happens if you don’t. Sheesh!
I believe there isn’t enough room on the form to write all that. Yes, when you are asked by the INS folks what your purpose for coming here is, you can say to attend a rally/march/peace protest. It might hold you up for a bit if they want to search your bags or do a background check on you et al., but you should still be allowed to come in. As others have stated, the easiest way to avoid it is saying you just want to see the sites, being a tourist, attending an educational conference, etcetera.
Categories of Non-Immigrant Visa (As you can see, it is the easiest to go with tourist visa)
The Visa Information Line (Looks like that is more for immigrant visas)
Nonimmigrant Visas from the US State Dept. (Lots of info there)
Visa forms (Don’t worrying about filling these out in advanced. They will be handed out probably at both airports [Japan and US] as well as on the plane)
Updates on visas (From the U.S. Embassy, Japan)
Please feel free to ask any more questions 
Divided we stand!

Subversive bastards
The only visa type which applies is a B-2. And if you state you will be attending a demonstration against the policies of the government of the US there are good chances you may be denied entry. It is totally at the discretion of the INS officer so you could run into a nazi republican or you could run into a socialist anti-republican and that may well determine whether you are allowed in or you are put on the next flight home.
Sailor is right. You have almost no chance of being allowed entry if you state that you’ll be attending a protest.
If you’re a Japanese citizen, you can enter the US under the Visa Waiver program.
IIRC, the form that you fill out on the plane (I-94W, it’s green) asks if you intend to commit a crime in the US (Free Immigration Hint #1: Check “No”). So if you somehow get in trouble with the law, you may get in hot water with the INS, as well.
The immigration officers do have considerable leeway - if you decide to to be confrontational about it, you’ll probably have a short stay at the airport and then find yourself going back. To take part in the Visa Waiver program you sign away any right to appeal the immigration officer’s decision. Ouch.
As far as I can tell, there’s no cut-and-dried answer. Depends on how big of an effort you make to get in the INS’ face. Just be aware that they have the right to turn you away for just about any reason.
Keep that crap in the Pit and GD.
Thank you. That’s exactly (and all) I wanted to know.
Are those who’re claiming that you’ll be denied entry if you tell them you’re there for a demonstration speaking from experience or speculation? What, the US fears “outside agitators” so much that they’ll refuse to let them into the country, fearing for the safety of their government?
That said, I could see getting denied if this was your stated aim, but I don’t think it would be because they’re afraid of your politics. Rather, they might believe that you’re likely to commit crimes (or even terrorist acts) during your stay. As well, being upfront about your intentions could be perceived as a challenge to the INS guy’s authority, depending on how you comport yourself.
We’re pretty open about protesting here; for many, its become quite a hobby. If you just looked like a neo-hippie, and you were polite about it, and clear about what you were attending, I could see you getting in quite easily.
However, obviously, why tell the truth and risk it?