How do I refuse to work on military-focused contracts? I'm applying to programs in Computer Science and Robotics and would feel very uncomfortable working on defense-focused or funded projects. 
Is it unrealistic (in terms of funding opportunities) to refuse to work on such projects? 
If not, at what point in application/admission does it make sense to make this expectation clear?
This answer is for the US, based on my experience with US admissions. 

I would say that this is generally not an applications/admissions question, only because it's unlikely to be meaningful to admissions committees. Many graduate departments in computer science work on a cohort-admissions model, where a group of students are admitted each year and then are expected to find a faculty adviser once accepted. In this model it is up to you to find a research program that personally motivates you and then to persuade an adviser to take you on. It is at this stage that you would (and should) make it clear to a potential adviser that you're not willing to work on defense related projects. However, at this point it's probably moot because you're going to be talking to potential advisers based on your perceived compatibility.

What might be a better thing to do during the application process is to ask whether a candidate department conducts any defense related research. Then you can just not apply to defense-related organizations rather than make it a point of contention with programs that you're interested in. Additionally, most CS research is not defense related, and most all broad-based research departments will have plenty of research opportunities that are not defense projects. Consider that about 60% of US PhD students in Computer Science are foreign nationals and ineligible for this kind of work anyway. You will have no problem finding non-military projects to work on.

Some places are well-known as defense-related institutions- for example the MIT Lincoln Laboratory, the Naval Research Laboratory, or the Johns Hopkins Applied Physics Laboratory. It is usually obvious from these organization's websites that this is a focus of theirs, and you can just avoid them. However, if you wanted to apply to a place such as this I would definitely discuss your personal ethics eariler rather than later, and your ethics definitely don't disqualify you. These labs do a lot of research that is "defense-related" in the sense that it provides for the common defense of the country, not because it's a military project. They work on everything from actual weapons systems to civil defense projects like weather satellites, making the energy grid more robust, and information security.